diff options
-rw-r--r-- | changelogs/unreleased/rails5-fix-47804.yml | 5 | ||||
-rw-r--r-- | changelogs/unreleased/rails5-fix-47805.yml | 6 | ||||
-rw-r--r-- | changelogs/unreleased/rails5-fix-47835.yml | 6 | ||||
-rw-r--r-- | lib/api/helpers.rb | 3 | ||||
-rw-r--r-- | spec/controllers/admin/application_settings_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/controllers/application_controller_spec.rb | 8 |
6 files changed, 24 insertions, 6 deletions
diff --git a/changelogs/unreleased/rails5-fix-47804.yml b/changelogs/unreleased/rails5-fix-47804.yml new file mode 100644 index 00000000000..3332ed3bbaa --- /dev/null +++ b/changelogs/unreleased/rails5-fix-47804.yml @@ -0,0 +1,5 @@ +--- +title: Rails5 fix stack level too deep +merge_request: 19762 +author: Jasper Maes +type: fixed diff --git a/changelogs/unreleased/rails5-fix-47805.yml b/changelogs/unreleased/rails5-fix-47805.yml new file mode 100644 index 00000000000..8bd8ad5488c --- /dev/null +++ b/changelogs/unreleased/rails5-fix-47805.yml @@ -0,0 +1,6 @@ +--- +title: 'Rails5 ActionController::ParameterMissing: param is missing or the value is + empty: application_setting' +merge_request: 19763 +author: Jasper Maes +type: fixed diff --git a/changelogs/unreleased/rails5-fix-47835.yml b/changelogs/unreleased/rails5-fix-47835.yml new file mode 100644 index 00000000000..fe9cbf1a03a --- /dev/null +++ b/changelogs/unreleased/rails5-fix-47835.yml @@ -0,0 +1,6 @@ +--- +title: Rails5 fix no implicit conversion of Hash into String. ActionController::Parameters + no longer returns an hash in Rails 5 +merge_request: 19792 +author: Jasper Maes +type: fixed diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 2ed331d4fd2..9c53b7c3fe7 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -272,7 +272,8 @@ module API attrs[key] = params_hash[key] end end - ActionController::Parameters.new(attrs).permit! + permitted_attrs = ActionController::Parameters.new(attrs).permit! + Gitlab.rails5? ? permitted_attrs.to_h : permitted_attrs end def filter_by_iid(items, iid) diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb index b4fc2aa326f..9d10d725ff3 100644 --- a/spec/controllers/admin/application_settings_controller_spec.rb +++ b/spec/controllers/admin/application_settings_controller_spec.rb @@ -73,7 +73,7 @@ describe Admin::ApplicationSettingsController do end it 'updates the restricted_visibility_levels when empty array is passed' do - put :update, application_setting: { restricted_visibility_levels: [] } + put :update, application_setting: { restricted_visibility_levels: [""] } expect(response).to redirect_to(admin_application_settings_path) expect(ApplicationSetting.current.restricted_visibility_levels).to be_empty diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index fbafb4a4de8..74f362fd7fc 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -512,7 +512,7 @@ describe ApplicationController do context '422 errors' do it 'logs a response with a string' do - response = spy(ActionDispatch::Response, status: 422, body: 'Hello world', content_type: 'application/json') + response = spy(ActionDispatch::Response, status: 422, body: 'Hello world', content_type: 'application/json', cookies: {}) allow(controller).to receive(:response).and_return(response) get :index @@ -521,7 +521,7 @@ describe ApplicationController do it 'logs a response with an array' do body = ['I want', 'my hat back'] - response = spy(ActionDispatch::Response, status: 422, body: body, content_type: 'application/json') + response = spy(ActionDispatch::Response, status: 422, body: body, content_type: 'application/json', cookies: {}) allow(controller).to receive(:response).and_return(response) get :index @@ -529,7 +529,7 @@ describe ApplicationController do end it 'does not log a string with an empty body' do - response = spy(ActionDispatch::Response, status: 422, body: nil, content_type: 'application/json') + response = spy(ActionDispatch::Response, status: 422, body: nil, content_type: 'application/json', cookies: {}) allow(controller).to receive(:response).and_return(response) get :index @@ -537,7 +537,7 @@ describe ApplicationController do end it 'does not log an HTML body' do - response = spy(ActionDispatch::Response, status: 422, body: 'This is a test', content_type: 'application/html') + response = spy(ActionDispatch::Response, status: 422, body: 'This is a test', content_type: 'application/html', cookies: {}) allow(controller).to receive(:response).and_return(response) get :index |