Skip to content

Commit

Permalink
Use the more idiomatic let in main_command_spec
Browse files Browse the repository at this point in the history
instead of instance variable
  • Loading branch information
amcinnes committed Nov 25, 2020
1 parent 8717beb commit 5ac0574
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions spec/stackup/main_command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 5ac0574

Please sign in to comment.