diff options
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/integration/bin/puppetmasterd.rb | 23 | ||||
| -rwxr-xr-x | spec/unit/util/settings.rb | 17 |
2 files changed, 40 insertions, 0 deletions
diff --git a/spec/integration/bin/puppetmasterd.rb b/spec/integration/bin/puppetmasterd.rb index b5a3f96da..2dcd593d3 100755 --- a/spec/integration/bin/puppetmasterd.rb +++ b/spec/integration/bin/puppetmasterd.rb @@ -107,4 +107,27 @@ describe "puppetmasterd" do end it "should exit with return code 1 after parsing if --parseonly is set and there are errors" + + describe "when run for the first time" do + before do + @ssldir = File.join(@dir, 'ssl') + FileUtils.rm_r(@ssldir) if File.exists?(@ssldir) + end + + describe "with noop" do + it "should create its ssl directory" do + File.directory?(@ssldir).should be_false + start(' --noop') + File.directory?(@ssldir).should be_true + end + end + + describe "without noop" do + it "should create its ssl directory" do + File.directory?(@ssldir).should be_false + start + File.directory?(@ssldir).should be_true + end + end + end end diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb index aa2101f6e..7527031de 100755 --- a/spec/unit/util/settings.rb +++ b/spec/unit/util/settings.rb @@ -718,6 +718,7 @@ describe Puppet::Util::Settings do before do @settings = Puppet::Util::Settings.new @settings.stubs(:service_user_available?).returns true + @settings.setdefaults :main, :noop => [false, ""] @settings.setdefaults :main, :maindir => ["/maindir", "a"], :seconddir => ["/seconddir", "a"] @settings.setdefaults :main, :user => ["suser", "doc"], :group => ["sgroup", "doc"] @settings.setdefaults :other, :otherdir => {:default => "/otherdir", :desc => "a", :owner => "service", :group => "service", :mode => 0755} @@ -999,4 +1000,20 @@ 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 + end end |
