diff options
author | Jasper Maes <jaspermaes.jm@gmail.com> | 2018-12-16 13:01:11 +0100 |
---|---|---|
committer | Jasper Maes <jaspermaes.jm@gmail.com> | 2018-12-16 13:45:19 +0100 |
commit | de399c4a497a08cff956ba6ad244b01f6c5afa63 (patch) | |
tree | 4e1633ef3e932bdfc1b2f0838880a9b5af210de6 | |
parent | 8b4602041cf2c4a8738a4796d78720017249249f (diff) | |
download | gitlab-ce-de399c4a497a08cff956ba6ad244b01f6c5afa63.tar.gz |
Fix deprecation: Comparing equality between ActionController::Parameters and a Hash is deprecated
6 files changed, 16 insertions, 10 deletions
diff --git a/changelogs/unreleased/deprecated-comparing-actioncontroller-params-hash.yml b/changelogs/unreleased/deprecated-comparing-actioncontroller-params-hash.yml new file mode 100644 index 00000000000..a7b9d054a4c --- /dev/null +++ b/changelogs/unreleased/deprecated-comparing-actioncontroller-params-hash.yml @@ -0,0 +1,6 @@ +--- +title: 'Fix deprecation: Comparing equality between ActionController::Parameters and + a Hash is deprecated' +merge_request: 23855 +author: Jasper Maes +type: other diff --git a/spec/controllers/concerns/issuable_collections_spec.rb b/spec/controllers/concerns/issuable_collections_spec.rb index f87eed6ff9f..5a3a7a15f5a 100644 --- a/spec/controllers/concerns/issuable_collections_spec.rb +++ b/spec/controllers/concerns/issuable_collections_spec.rb @@ -90,7 +90,7 @@ describe IssuableCollections do 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 @@ describe IssuableCollections do 'search' => 'baz', 'sort' => 'priority', 'state' => 'opened' - }) + }).permit!) end end end diff --git a/spec/controllers/profiles/preferences_controller_spec.rb b/spec/controllers/profiles/preferences_controller_spec.rb index a66b4ab0902..b580e773459 100644 --- a/spec/controllers/profiles/preferences_controller_spec.rb +++ b/spec/controllers/profiles/preferences_controller_spec.rb @@ -45,7 +45,7 @@ describe Profiles::PreferencesController do 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 diff --git a/spec/controllers/projects/notes_controller_spec.rb b/spec/controllers/projects/notes_controller_spec.rb index d2a26068362..9a5df2aded7 100644 --- a/spec/controllers/projects/notes_controller_spec.rb +++ b/spec/controllers/projects/notes_controller_spec.rb @@ -248,13 +248,13 @@ describe Projects::NotesController do 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 diff --git a/spec/controllers/projects/pages_domains_controller_spec.rb b/spec/controllers/projects/pages_domains_controller_spec.rb index 75871eab1ab..b9cf3e9b091 100644 --- a/spec/controllers/projects/pages_domains_controller_spec.rb +++ b/spec/controllers/projects/pages_domains_controller_spec.rb @@ -78,7 +78,7 @@ describe Projects::PagesDomainsController do 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) diff --git a/spec/requests/jwt_controller_spec.rb b/spec/requests/jwt_controller_spec.rb index e042d772718..2d87d236d61 100644 --- a/spec/requests/jwt_controller_spec.rb +++ b/spec/requests/jwt_controller_spec.rb @@ -31,7 +31,7 @@ describe JwtController do 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 @@ describe JwtController do 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 @@ describe JwtController do 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 @@ describe JwtController do 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) } |