Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
varyonic committed Feb 7, 2022
1 parent 4cc1e6a commit bce0145
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions spec/unit/resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/view_helpers/form_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
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

it 'allows the form builder to be customized' do
# 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
Expand Down

0 comments on commit bce0145

Please sign in to comment.