Commit de399c4a authored by Jasper Maes's avatar Jasper Maes

Fix deprecation: Comparing equality between ActionController::Parameters and a Hash is deprecated

parent 8b460204
---
title: 'Fix deprecation: Comparing equality between ActionController::Parameters and
a Hash is deprecated'
merge_request: 23855
author: Jasper Maes
type: other
...@@ -90,7 +90,7 @@ describe IssuableCollections do ...@@ -90,7 +90,7 @@ describe IssuableCollections do
finder_options = controller.send(:finder_options) finder_options = controller.send(:finder_options)
expect(finder_options).to eq({ expect(finder_options).to eq(ActionController::Parameters.new({
'assignee_id' => '1', 'assignee_id' => '1',
'assignee_username' => 'user1', 'assignee_username' => 'user1',
'author_id' => '2', 'author_id' => '2',
...@@ -103,7 +103,7 @@ describe IssuableCollections do ...@@ -103,7 +103,7 @@ describe IssuableCollections do
'search' => 'baz', 'search' => 'baz',
'sort' => 'priority', 'sort' => 'priority',
'state' => 'opened' 'state' => 'opened'
}) }).permit!)
end end
end end
end end
...@@ -45,7 +45,7 @@ describe Profiles::PreferencesController do ...@@ -45,7 +45,7 @@ describe Profiles::PreferencesController do
theme_id: '2' theme_id: '2'
}.with_indifferent_access }.with_indifferent_access
expect(user).to receive(:assign_attributes).with(prefs) expect(user).to receive(:assign_attributes).with(ActionController::Parameters.new(prefs).permit!)
expect(user).to receive(:save) expect(user).to receive(:save)
go params: prefs go params: prefs
......
...@@ -248,13 +248,13 @@ describe Projects::NotesController do ...@@ -248,13 +248,13 @@ describe Projects::NotesController do
context 'when merge_request_diff_head_sha present' do context 'when merge_request_diff_head_sha present' do
before do before do
service_params = { service_params = ActionController::Parameters.new({
note: 'some note', note: 'some note',
noteable_id: merge_request.id.to_s, noteable_id: merge_request.id.to_s,
noteable_type: 'MergeRequest', noteable_type: 'MergeRequest',
merge_request_diff_head_sha: 'sha', merge_request_diff_head_sha: 'sha',
in_reply_to_discussion_id: nil in_reply_to_discussion_id: nil
} }).permit!
expect(Notes::CreateService).to receive(:new).with(project, user, service_params).and_return(double(execute: true)) expect(Notes::CreateService).to receive(:new).with(project, user, service_params).and_return(double(execute: true))
end end
......
...@@ -78,7 +78,7 @@ describe Projects::PagesDomainsController do ...@@ -78,7 +78,7 @@ describe Projects::PagesDomainsController do
it 'updates the domain' do it 'updates the domain' do
expect(pages_domain) expect(pages_domain)
.to receive(:update) .to receive(:update)
.with(pages_domain_params) .with(ActionController::Parameters.new(pages_domain_params).permit!)
.and_return(true) .and_return(true)
patch(:update, params) patch(:update, params)
......
...@@ -31,7 +31,7 @@ describe JwtController do ...@@ -31,7 +31,7 @@ describe JwtController do
context 'project with enabled CI' do context 'project with enabled CI' do
subject! { get '/jwt/auth', parameters, headers } subject! { get '/jwt/auth', parameters, headers }
it { expect(service_class).to have_received(:new).with(project, nil, parameters) } it { expect(service_class).to have_received(:new).with(project, nil, ActionController::Parameters.new(parameters).permit!) }
end end
context 'project with disabled CI' do context 'project with disabled CI' do
...@@ -57,7 +57,7 @@ describe JwtController do ...@@ -57,7 +57,7 @@ describe JwtController do
it 'authenticates correctly' do it 'authenticates correctly' do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(service_class).to have_received(:new).with(nil, user, parameters) expect(service_class).to have_received(:new).with(nil, user, ActionController::Parameters.new(parameters).permit!)
end end
end end
end end
...@@ -68,7 +68,7 @@ describe JwtController do ...@@ -68,7 +68,7 @@ describe JwtController do
subject! { get '/jwt/auth', parameters, headers } subject! { get '/jwt/auth', parameters, headers }
it { expect(service_class).to have_received(:new).with(nil, user, parameters) } it { expect(service_class).to have_received(:new).with(nil, user, ActionController::Parameters.new(parameters).permit!) }
context 'when passing a flat array of scopes' do context 'when passing a flat array of scopes' do
# We use this trick to make rails to generate a query_string: # We use this trick to make rails to generate a query_string:
...@@ -83,7 +83,7 @@ describe JwtController do ...@@ -83,7 +83,7 @@ describe JwtController do
end end
let(:service_parameters) do let(:service_parameters) do
{ service: service_name, scopes: %w(scope1 scope2) } ActionController::Parameters.new({ service: service_name, scopes: %w(scope1 scope2) }).permit!
end end
it { expect(service_class).to have_received(:new).with(nil, user, service_parameters) } it { expect(service_class).to have_received(:new).with(nil, user, service_parameters) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment