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 @@ def finder_type
finder_options = controller.send(:finder_options)
expect(finder_options).to eq({
expect(finder_options).to eq(ActionController::Parameters.new({
'assignee_id' => '1',
'assignee_username' => 'user1',
'author_id' => '2',
......@@ -103,7 +103,7 @@ def finder_type
'search' => 'baz',
'sort' => 'priority',
'state' => 'opened'
})
}).permit!)
end
end
end
......@@ -45,7 +45,7 @@ def go(params: {}, format: :js)
theme_id: '2'
}.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)
go params: prefs
......
......@@ -248,13 +248,13 @@
context 'when merge_request_diff_head_sha present' do
before do
service_params = {
service_params = ActionController::Parameters.new({
note: 'some note',
noteable_id: merge_request.id.to_s,
noteable_type: 'MergeRequest',
merge_request_diff_head_sha: 'sha',
in_reply_to_discussion_id: nil
}
}).permit!
expect(Notes::CreateService).to receive(:new).with(project, user, service_params).and_return(double(execute: true))
end
......
......@@ -78,7 +78,7 @@
it 'updates the domain' do
expect(pages_domain)
.to receive(:update)
.with(pages_domain_params)
.with(ActionController::Parameters.new(pages_domain_params).permit!)
.and_return(true)
patch(:update, params)
......
......@@ -31,7 +31,7 @@
context 'project with enabled CI' do
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
context 'project with disabled CI' do
......@@ -57,7 +57,7 @@
it 'authenticates correctly' do
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
......@@ -68,7 +68,7 @@
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
# We use this trick to make rails to generate a query_string:
......@@ -83,7 +83,7 @@
end
let(:service_parameters) do
{ service: service_name, scopes: %w(scope1 scope2) }
ActionController::Parameters.new({ service: service_name, scopes: %w(scope1 scope2) }).permit!
end
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