From 6a2e315ad9a670e4cc255155b3fd44c046f0e69e Mon Sep 17 00:00:00 2001 From: Andrew Bobulsky Date: Wed, 19 Apr 2023 17:38:59 -0400 Subject: [PATCH] fix(tests): Ruby 3 compatibility for RSpec suite 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: https://github.com/rspec/rspec-mocks/issues/1460 Signed-off-by: Andrew Bobulsky --- .../driver/aws/instance_generator_spec.rb | 58 ++++++++++--------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/spec/kitchen/driver/aws/instance_generator_spec.rb b/spec/kitchen/driver/aws/instance_generator_spec.rb index 5c9d6f71..cf309861 100644 --- a/spec/kitchen/driver/aws/instance_generator_spec.rb +++ b/spec/kitchen/driver/aws/instance_generator_spec.rb @@ -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 @@ -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 @@ -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(