Skip to content

Commit

Permalink
fix(tests): Ruby 3 compatibility for RSpec suite
Browse files Browse the repository at this point in the history
RSpec tests under Ruby 3 were broken by ambiguous arguments.
This patch fixes the test suite under Ruby 3 and is backward compatible.

Discussion on this issue can be found in rspec repo:
rspec/rspec-mocks#1460

Signed-off-by: Andrew Bobulsky <rulerof@gmail.com>
  • Loading branch information
RulerOf committed Apr 19, 2023
1 parent 9094696 commit 6a2e315
Showing 1 changed file with 32 additions and 26 deletions.
58 changes: 32 additions & 26 deletions spec/kitchen/driver/aws/instance_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,14 @@
it "generates id from the provided tag" do
allow(::Aws::EC2::Client).to receive(:new).and_return(ec2_stub)
expect(ec2_stub).to receive(:describe_subnets).with(
filters: [
{
name: "tag:foo",
values: ["bar"],
},
]
{
filters: [
{
name: "tag:foo",
values: ["bar"],
},
]
}
).and_return(ec2_stub.describe_subnets)
expect(generator.ec2_instance_data[:subnet_id]).to eq("s-123")
end
Expand All @@ -240,16 +242,18 @@
it "generates id from the provided tag" do
allow(::Aws::EC2::Client).to receive(:new).and_return(ec2_stub)
expect(ec2_stub).to receive(:describe_security_groups).with(
filters: [
{
name: "tag:foo",
values: ["bar"],
},
{
name: "vpc-id",
values: ["vpc-456"],
},
]
{
filters: [
{
name: "tag:foo",
values: ["bar"],
},
{
name: "vpc-id",
values: ["vpc-456"],
},
]
}
).and_return(ec2_stub.describe_security_groups)
expect(generator.ec2_instance_data[:security_group_ids]).to eq(["sg-123"])
end
Expand Down Expand Up @@ -287,16 +291,18 @@
it "generates id from the provided tag" do
allow(::Aws::EC2::Client).to receive(:new).and_return(ec2_stub_whithout_security_group)
expect(ec2_stub_whithout_security_group).to receive(:describe_security_groups).with(
filters: [
{
name: "tag:foo",
values: ["bar"],
},
{
name: "vpc-id",
values: ["vpc-456"],
},
]
{
filters: [
{
name: "tag:foo",
values: ["bar"],
},
{
name: "vpc-id",
values: ["vpc-456"],
},
]
}
).and_return(ec2_stub_whithout_security_group.describe_security_groups)

expect { generator.ec2_instance_data }.to raise_error(
Expand Down

0 comments on commit 6a2e315

Please sign in to comment.