diff options
author | Luke Kanies <luke@madstop.com> | 2008-03-13 12:36:21 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-03-13 12:36:21 -0500 |
commit | ecb873d3a6d2eabc931457bd8f4c185c990976db (patch) | |
tree | f1741fe46caf38f17e57653e0aa1ea83cf7973ef /spec/unit | |
parent | e2370b37a73db94f4c099a9c54e2443b3c838fa0 (diff) | |
download | puppet-ecb873d3a6d2eabc931457bd8f4c185c990976db.tar.gz puppet-ecb873d3a6d2eabc931457bd8f4c185c990976db.tar.xz puppet-ecb873d3a6d2eabc931457bd8f4c185c990976db.zip |
Fixing #1118 -- downloading plugins and facts now ignores noop.
Note that this changes the behaviour a bit -- the resource's
noop setting always beats the global setting (previously,
whichever was true would win).
Diffstat (limited to 'spec/unit')
-rwxr-xr-x | spec/unit/ral/type/noop_metaparam.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/unit/ral/type/noop_metaparam.rb b/spec/unit/ral/type/noop_metaparam.rb new file mode 100755 index 000000000..0cbed3714 --- /dev/null +++ b/spec/unit/ral/type/noop_metaparam.rb @@ -0,0 +1,38 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../../spec_helper' + +require 'puppet/metatype/metaparams' + +describe Puppet::Type.type(:file).attrclass(:noop) do + before do + @file = Puppet::Type.newfile :path => "/what/ever" + end + + after { Puppet::Type::File.clear } + + it "should accept true as a value" do + lambda { @file[:noop] = true }.should_not raise_error + end + + it "should accept false as a value" do + lambda { @file[:noop] = false }.should_not raise_error + end + + describe "when set on a resource" do + it "should default to the :noop setting" do + Puppet.settings.expects(:value).with(:noop).returns "myval" + @file.noop.should == "myval" + end + + it "should prefer true values from the attribute" do + @file[:noop] = true + @file.noop.should be_true + end + + it "should prefer false values from the attribute" do + @file[:noop] = false + @file.noop.should be_false + end + end +end |