diff options
-rw-r--r-- | lib/chef/knife/client_key_create.rb | 2 | ||||
-rw-r--r-- | lib/chef/knife/user_key_create.rb | 2 | ||||
-rw-r--r-- | spec/unit/knife/key_create_spec.rb | 8 |
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/chef/knife/client_key_create.rb b/lib/chef/knife/client_key_create.rb index 372655b7ab..2d9b49789a 100644 --- a/lib/chef/knife/client_key_create.rb +++ b/lib/chef/knife/client_key_create.rb @@ -82,7 +82,7 @@ class Chef if @actor.nil? show_usage ui.fatal(actor_missing_error) - return 1 + exit 1 end end end diff --git a/lib/chef/knife/user_key_create.rb b/lib/chef/knife/user_key_create.rb index 4434ec87b3..ebde7188f4 100644 --- a/lib/chef/knife/user_key_create.rb +++ b/lib/chef/knife/user_key_create.rb @@ -82,7 +82,7 @@ class Chef if @actor.nil? show_usage ui.fatal(actor_missing_error) - return 1 + exit 1 end end end diff --git a/spec/unit/knife/key_create_spec.rb b/spec/unit/knife/key_create_spec.rb index a02573b486..1bdd0f3ba1 100644 --- a/spec/unit/knife/key_create_spec.rb +++ b/spec/unit/knife/key_create_spec.rb @@ -42,16 +42,16 @@ describe "key create commands that inherit knife" do context "when apply_params! is called with invalid args" do it "shows the usage" do expect(command).to receive(:show_usage) - command.apply_params!(params) + expect { command.apply_params!(params) }.to exit_with_code(1) end it "outputs the proper error" do - command.apply_params!(params) + expect { command.apply_params!(params) }.to exit_with_code(1) expect(stderr.string).to include(command.actor_missing_error) end - it "returns 1" do - expect(command.apply_params!(params)).to eq(1) + it "exits 1" do + expect { command.apply_params!(params) }.to exit_with_code(1) end end end # before apply_params! is called |