diff options
Diffstat (limited to 'spec/unit/application/apply_spec.rb')
-rwxr-xr-x | spec/unit/application/apply_spec.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/spec/unit/application/apply_spec.rb b/spec/unit/application/apply_spec.rb index 8aaa5d8f9..0c6df2cf8 100755 --- a/spec/unit/application/apply_spec.rb +++ b/spec/unit/application/apply_spec.rb @@ -52,7 +52,6 @@ describe Puppet::Application::Apply do before :each do Puppet::Log.stubs(:newdestination) - Puppet.stubs(:trap) Puppet::Log.stubs(:level=) Puppet.stubs(:parse_config) Puppet::FileBucket::Dipper.stubs(:new) @@ -79,7 +78,7 @@ describe Puppet::Application::Apply do end it "should set INT trap" do - @apply.expects(:trap).with(:INT) + Signal.expects(:trap).with(:INT) @apply.setup end @@ -172,6 +171,13 @@ describe Puppet::Application::Apply do @apply.expects(:exit).with(1) @apply.parseonly end + + it "should exit with exit code 1 if error, even if --noop is set" do + Puppet[:noop] = true + @environment.stubs(:perform_initial_import).raises(Puppet::ParseError) + @apply.expects(:exit).with(1) + @apply.parseonly + end end describe "the main command" do @@ -342,6 +348,15 @@ describe Puppet::Application::Apply do @apply.main end + it "should exit with report's computed exit status, even if --noop is set" do + Puppet.stubs(:[]).with(:noop).returns(true) + @apply.options.stubs(:[]).with(:detailed_exitcodes).returns(true) + Puppet::Transaction::Report.any_instance.stubs(:exit_status).returns(666) + @apply.expects(:exit).with(666) + + @apply.main + end + it "should always exit with 0 if option is disabled" do Puppet.stubs(:[]).with(:noop).returns(false) @apply.options.stubs(:[]).with(:detailed_exitcodes).returns(false) |