From bce01453466c70696775e70c84f8894f6ad2c0aa Mon Sep 17 00:00:00 2001 From: Piers Chambers Date: Mon, 7 Feb 2022 16:23:31 -0500 Subject: [PATCH] rspec/rspec-mocks#1460 Previously keyword arguments were broken, and this change fixed them. That it unforuntately makes some previous specs invalid (which were incorrect on Ruby 3) is sad. --- spec/unit/resource_spec.rb | 6 +++--- spec/unit/view_helpers/form_helper_spec.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 8f5a919ab52..648ef8343b9 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -241,8 +241,8 @@ class MockResource let(:resource) { namespace.register(Post) } let(:post) { double } before do - allow(Post).to receive(:find_by).with("id" => "12345") { post } - allow(Post).to receive(:find_by).with("id" => "54321") { nil } + allow(Post).to receive(:find_by).with({"id" => "12345"}) { post } + allow(Post).to receive(:find_by).with({"id" => "54321"}) { nil } end it 'can find the resource' do @@ -265,7 +265,7 @@ class MockResource before do allow(Post).to receive(:primary_key).and_return 'something_else' allow(Post).to receive(:find_by). - with("something_else" => "55555") { different_post } + with({"something_else" => "55555"}) { different_post } end it 'can find the post by the custom primary key' do diff --git a/spec/unit/view_helpers/form_helper_spec.rb b/spec/unit/view_helpers/form_helper_spec.rb index 3268991220d..7fcb92a4063 100644 --- a/spec/unit/view_helpers/form_helper_spec.rb +++ b/spec/unit/view_helpers/form_helper_spec.rb @@ -8,7 +8,7 @@ let(:default_options) { { builder: ActiveAdmin::FormBuilder } } it 'calls semantic_form_for with the ActiveAdmin form builder' do - expect(view).to receive(:semantic_form_for).with(resource, builder: ActiveAdmin::FormBuilder) + expect(view).to receive(:semantic_form_for).with(resource, { builder: ActiveAdmin::FormBuilder }) view.active_admin_form_for(resource) end @@ -16,7 +16,7 @@ # We can't use a stub here because options gets marshalled, and a new # instance built. Any constant will work. custom_builder = Object - expect(view).to receive(:semantic_form_for).with(resource, builder: custom_builder) + expect(view).to receive(:semantic_form_for).with(resource, { builder: custom_builder }) view.active_admin_form_for(resource, builder: custom_builder) end end