Commit 1ad109b6 authored by Abdul Wadood's avatar Abdul Wadood

Fix Rails/SaveBang offenses for auth controllers

Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/220040
parent ff346be2
......@@ -182,8 +182,6 @@ Rails/SaveBang:
- 'spec/controllers/groups/runners_controller_spec.rb'
- 'spec/controllers/groups/uploads_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/notifications_controller_spec.rb'
- 'spec/controllers/projects_controller_spec.rb'
......
......@@ -54,7 +54,7 @@ RSpec.describe Oauth::AuthorizationsController do
shared_examples "Implicit grant can't be used in confidential application" do
context 'when application is confidential' do
before do
application.update(confidential: true)
application.update!(confidential: true)
params[:response_type] = 'token'
end
......@@ -96,7 +96,7 @@ RSpec.describe Oauth::AuthorizationsController do
end
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'
subject
......
......@@ -60,7 +60,7 @@ RSpec.describe OmniauthCallbacksController, type: :controller do
let(:extern_uid) { 'my-uid' }
before do
user.update(failed_attempts: User.maximum_attempts.pred)
user.update!(failed_attempts: User.maximum_attempts.pred)
subject.response = ActionDispatch::Response.new
end
......@@ -233,7 +233,7 @@ RSpec.describe OmniauthCallbacksController, type: :controller do
before do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
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
it 'prevents login via POST' do
......@@ -299,7 +299,7 @@ RSpec.describe OmniauthCallbacksController, type: :controller do
before do
stub_omniauth_setting(enabled: true, auto_link_user: true, allow_single_sign_on: ['atlassian_oauth2'])
user.destroy
user.destroy!
end
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
context 'sign up' do
before do
user.destroy
user.destroy!
end
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