diff options
| author | Luke Kanies <luke@reductivelabs.com> | 2009-12-21 17:05:47 -0800 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2010-03-25 16:16:42 +1100 |
| commit | fbedb999e4f4cc8020bc6be4a1d8868368c3ed7f (patch) | |
| tree | 4812ea152b9f54fd57a5399b0c963cefda0efb80 /spec | |
| parent | 389c77b1927a95e8e991ecddd1767698547a78b8 (diff) | |
Fixing #3148 Settings#without_noop when run with no noop setting
Some tests didn't define this setting which caused this method
to fail.
Signed-off-by: Luke Kanies <luke@reductivelabs.com>
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/util/settings.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb index 56428132d..645b54366 100755 --- a/spec/unit/util/settings.rb +++ b/spec/unit/util/settings.rb @@ -1018,4 +1018,27 @@ describe Puppet::Util::Settings do it "should cache the result" end + + describe "#without_noop" do + before do + @settings = Puppet::Util::Settings.new + @settings.setdefaults :main, :noop => [true, ""] + end + + it "should set noop to false for the duration of the block" do + @settings.without_noop { @settings.value(:noop, :cli).should be_false } + end + + it "should ensure that noop is returned to its previous value" do + @settings.without_noop { raise } rescue nil + @settings.value(:noop, :cli).should be_true + end + + it "should work even if no 'noop' setting is available" do + settings = Puppet::Util::Settings.new + stuff = nil + settings.without_noop { stuff = "yay" } + stuff.should == "yay" + end + end end |
