Commit bcc0afb7 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Merge branch 'rails-save-bang-auth-controllers' into 'master'

Fix Rails/SaveBang offenses for auth controllers

See merge request gitlab-org/gitlab!57886
parents 7fe883e2 b33a6b33
...@@ -182,8 +182,6 @@ Rails/SaveBang: ...@@ -182,8 +182,6 @@ Rails/SaveBang:
- 'spec/controllers/groups/runners_controller_spec.rb' - 'spec/controllers/groups/runners_controller_spec.rb'
- 'spec/controllers/groups/uploads_controller_spec.rb' - 'spec/controllers/groups/uploads_controller_spec.rb'
- 'spec/controllers/groups_controller_spec.rb' - 'spec/controllers/groups_controller_spec.rb'
- 'spec/controllers/oauth/authorizations_controller_spec.rb'
- 'spec/controllers/omniauth_callbacks_controller_spec.rb'
- 'spec/controllers/profiles/emails_controller_spec.rb' - 'spec/controllers/profiles/emails_controller_spec.rb'
- 'spec/controllers/profiles/notifications_controller_spec.rb' - 'spec/controllers/profiles/notifications_controller_spec.rb'
- 'spec/controllers/projects_controller_spec.rb' - 'spec/controllers/projects_controller_spec.rb'
......
---
title: Fix Rails/SaveBang rubocop offenses in auth controllers
merge_request: 57886
author: Abdul Wadood @abdulwd
type: fixed
...@@ -54,7 +54,7 @@ RSpec.describe Oauth::AuthorizationsController do ...@@ -54,7 +54,7 @@ RSpec.describe Oauth::AuthorizationsController do
shared_examples "Implicit grant can't be used in confidential application" do shared_examples "Implicit grant can't be used in confidential application" do
context 'when application is confidential' do context 'when application is confidential' do
before do before do
application.update(confidential: true) application.update!(confidential: true)
params[:response_type] = 'token' params[:response_type] = 'token'
end end
...@@ -96,7 +96,7 @@ RSpec.describe Oauth::AuthorizationsController do ...@@ -96,7 +96,7 @@ RSpec.describe Oauth::AuthorizationsController do
end end
it 'deletes session.user_return_to and redirects when skip authorization' do it 'deletes session.user_return_to and redirects when skip authorization' do
application.update(trusted: true) application.update!(trusted: true)
request.session['user_return_to'] = 'http://example.com' request.session['user_return_to'] = 'http://example.com'
subject subject
......
...@@ -60,7 +60,7 @@ RSpec.describe OmniauthCallbacksController, type: :controller do ...@@ -60,7 +60,7 @@ RSpec.describe OmniauthCallbacksController, type: :controller do
let(:extern_uid) { 'my-uid' } let(:extern_uid) { 'my-uid' }
before do before do
user.update(failed_attempts: User.maximum_attempts.pred) user.update!(failed_attempts: User.maximum_attempts.pred)
subject.response = ActionDispatch::Response.new subject.response = ActionDispatch::Response.new
end end
...@@ -233,7 +233,7 @@ RSpec.describe OmniauthCallbacksController, type: :controller do ...@@ -233,7 +233,7 @@ RSpec.describe OmniauthCallbacksController, type: :controller do
before do before do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
settings = Gitlab::CurrentSettings.current_application_settings settings = Gitlab::CurrentSettings.current_application_settings
settings.update(disabled_oauth_sign_in_sources: [provider.to_s]) settings.update!(disabled_oauth_sign_in_sources: [provider.to_s])
end end
it 'prevents login via POST' do it 'prevents login via POST' do
...@@ -299,7 +299,7 @@ RSpec.describe OmniauthCallbacksController, type: :controller do ...@@ -299,7 +299,7 @@ RSpec.describe OmniauthCallbacksController, type: :controller do
before do before do
stub_omniauth_setting(enabled: true, auto_link_user: true, allow_single_sign_on: ['atlassian_oauth2']) stub_omniauth_setting(enabled: true, auto_link_user: true, allow_single_sign_on: ['atlassian_oauth2'])
user.destroy user.destroy!
end end
it 'denies sign-in if sign-up is enabled, but block_auto_created_users is set' do it 'denies sign-in if sign-up is enabled, but block_auto_created_users is set' do
...@@ -381,7 +381,7 @@ RSpec.describe OmniauthCallbacksController, type: :controller do ...@@ -381,7 +381,7 @@ RSpec.describe OmniauthCallbacksController, type: :controller do
context 'sign up' do context 'sign up' do
before do before do
user.destroy user.destroy!
end end
it 'denies login if sign up is enabled, but block_auto_created_users is set' do it 'denies login if sign up is enabled, but block_auto_created_users is set' do
......
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