Skip to content

Commit a4238ee

Browse files
taglialaremear
authored andcommitted
Fix params comparison deprecation warning
``` DEPRECATION WARNING: Comparing equality between `ActionController::Parameters` and a `Hash` is deprecated and will be removed in Rails 7.2. Please only do comparisons between instances of `ActionController::Parameters`. If you need to compare to a hash, first convert it using `ActionController::Parameters#new`. ```
1 parent d1012f1 commit a4238ee

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

spec/deserialization_spec.rb

+6-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ def create
2525
it 'makes the deserialized resource available in params' do
2626
post :create, params: payload
2727

28-
expected = { 'type' => 'users', 'name' => 'Lucas' }
28+
expected = ActionController::Parameters.new('type' => 'users',
29+
'name' => 'Lucas')
2930
expect(controller.params[:user]).to eq(expected)
3031
end
3132

@@ -54,7 +55,8 @@ def create
5455
it 'makes the deserialized resource available in params' do
5556
post :create, params: payload
5657

57-
expected = { 'type' => 'users', 'first_name' => 'Lucas' }
58+
expected = ActionController::Parameters.new('type' => 'users',
59+
'first_name' => 'Lucas')
5860
expect(controller.params[:user]).to eq(expected)
5961
end
6062

@@ -81,7 +83,8 @@ def create
8183
it 'makes the deserialized resource available in params' do
8284
post :create, params: payload
8385

84-
expected = { 'type' => 'users', 'Name' => 'Lucas' }
86+
expected = ActionController::Parameters.new('type' => 'users',
87+
'Name' => 'Lucas')
8588
expect(controller.params[:user]).to eq(expected)
8689
end
8790

0 commit comments

Comments
 (0)