diff --git a/spec/stackup/main_command_spec.rb b/spec/stackup/main_command_spec.rb index c5df7d8..0179c97 100644 --- a/spec/stackup/main_command_spec.rb +++ b/spec/stackup/main_command_spec.rb @@ -2,20 +2,21 @@ describe Stackup::MainCommand do context "change-set create --service-role-arn" + let(:mock_change_set) { double() } + before(:example) do mock_stackup = double() mock_stack = double() - @mock_change_set = double() allow_any_instance_of(Stackup::MainCommand).to receive(:Stackup).and_return(mock_stackup) allow(mock_stackup).to receive(:stack).and_return(mock_stack) - allow(mock_stack).to receive(:change_set).and_return(@mock_change_set) + allow(mock_stack).to receive(:change_set).and_return(mock_change_set) end it "invokes stack.change_set.create with role arn passed through" do expected_args = { role_arn: "arn:aws:iam::000000000000:role/example" } - expect(@mock_change_set).to receive(:create).with(hash_including(expected_args)) + expect(mock_change_set).to receive(:create).with(hash_including(expected_args)) Stackup::MainCommand.run("stackup", [ "STACK-NAME", "change-set", "create", @@ -28,7 +29,7 @@ expected_args = { allow_empty_change_set: nil } - expect(@mock_change_set).to receive(:create).with(hash_including(expected_args)) + expect(mock_change_set).to receive(:create).with(hash_including(expected_args)) Stackup::MainCommand.run("stackup", [ "STACK-NAME", "change-set", "create", @@ -41,7 +42,7 @@ expected_args = { allow_empty_change_set: true } - expect(@mock_change_set).to receive(:create).with(hash_including(expected_args)) + expect(mock_change_set).to receive(:create).with(hash_including(expected_args)) Stackup::MainCommand.run("stackup", [ "STACK-NAME", "change-set", "create",