Commit 143d072c authored by Markus Koller's avatar Markus Koller

Merge branch 'issue_220040_13' into 'master'

Fix Rails/SaveBang offenses

See merge request gitlab-org/gitlab!75975
parents b5b5aefa d06cdd6b
......@@ -8,10 +8,3 @@ Rails/SaveBang:
- spec/lib/gitlab/auth/ldap/user_spec.rb
- spec/lib/gitlab/auth/o_auth/user_spec.rb
- spec/lib/gitlab/auth/saml/user_spec.rb
- spec/lib/gitlab/auth_spec.rb
- spec/lib/gitlab/authorized_keys_spec.rb
- spec/lib/gitlab/bitbucket_server_import/importer_spec.rb
- spec/lib/gitlab/cycle_analytics/base_event_fetcher_spec.rb
- spec/lib/gitlab/database/custom_structure_spec.rb
- spec/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers_spec.rb
- spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb
......@@ -165,27 +165,27 @@ RSpec.describe Gitlab::Auth, :use_clean_rails_memory_store_caching do
end
it 'recognises user token' do
build.update(user: create(:user))
build.update!(user: create(:user))
expect(subject).to have_attributes(actor: build.user, project: build.project, type: :build, authentication_abilities: described_class.build_authentication_abilities)
end
it 'recognises project level bot access token' do
build.update(user: create(:user, :project_bot))
build.update!(user: create(:user, :project_bot))
project.add_maintainer(build.user)
expect(subject).to have_attributes(actor: build.user, project: build.project, type: :build, authentication_abilities: described_class.build_authentication_abilities)
end
it 'recognises group level bot access token' do
build.update(user: create(:user, :project_bot))
build.update!(user: create(:user, :project_bot))
group.add_maintainer(build.user)
expect(subject).to have_attributes(actor: build.user, project: build.project, type: :build, authentication_abilities: described_class.build_authentication_abilities)
end
it 'fails with blocked user token' do
build.update(user: create(:user, :blocked))
build.update!(user: create(:user, :blocked))
expect(subject).to have_attributes(auth_failure)
end
......@@ -213,7 +213,7 @@ RSpec.describe Gitlab::Auth, :use_clean_rails_memory_store_caching do
it 'recognizes other ci services' do
project.create_drone_ci_integration(active: true)
project.drone_ci_integration.update(token: 'token')
project.drone_ci_integration.update!(token: 'token', drone_url: generate(:url))
expect(gl_auth.find_for_git_client('drone-ci-token', 'token', project: project, ip: 'ip')).to have_attributes(actor: nil, project: project, type: :ci, authentication_abilities: described_class.build_authentication_abilities)
end
......@@ -326,7 +326,7 @@ RSpec.describe Gitlab::Auth, :use_clean_rails_memory_store_caching do
context 'orphaned token' do
before do
user.destroy
user.destroy!
end
it_behaves_like 'an oauth failure'
......@@ -903,7 +903,7 @@ RSpec.describe Gitlab::Auth, :use_clean_rails_memory_store_caching do
it 'resets failed_attempts when true and password is correct' do
user.failed_attempts = 2
user.save
user.save!
expect do
gl_auth.find_with_user_password(username, password, increment_failed_attempts: true)
......@@ -932,7 +932,7 @@ RSpec.describe Gitlab::Auth, :use_clean_rails_memory_store_caching do
it 'does not reset failed_attempts when true and password is correct' do
user.failed_attempts = 2
user.save
user.save!
expect do
gl_auth.find_with_user_password(username, password, increment_failed_attempts: true)
......
......@@ -38,7 +38,7 @@ RSpec.describe Gitlab::AuthorizedKeys do
end
describe '#create' do
subject { authorized_keys.create }
subject { authorized_keys.create } # rubocop:disable Rails/SaveBang
context 'authorized_keys file exists' do
before do
......
......@@ -22,8 +22,8 @@ RSpec.describe Gitlab::BitbucketServerImport::Importer do
data: { project_key: project_key, repo_slug: repo_slug },
credentials: { base_uri: import_url, user: bitbucket_user, password: password }
)
data.save
project.save
data.save!
project.save!
end
describe '#import_repository' do
......
......@@ -60,7 +60,7 @@ RSpec.describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService
before do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
application_setting.update(allow_local_requests_from_web_hooks_and_services: true)
application_setting.update!(allow_local_requests_from_web_hooks_and_services: true)
end
shared_examples 'has prometheus integration' do |server_address|
......@@ -181,7 +181,7 @@ RSpec.describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService
let(:existing_project) { create(:project, namespace: existing_group) }
before do
application_setting.update(instance_administrators_group_id: existing_group.id,
application_setting.update!(instance_administrators_group_id: existing_group.id,
self_monitoring_project_id: existing_project.id)
end
......@@ -195,7 +195,7 @@ RSpec.describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService
context 'when local requests from hooks and integrations are not allowed' do
before do
application_setting.update(allow_local_requests_from_web_hooks_and_services: false)
application_setting.update!(allow_local_requests_from_web_hooks_and_services: false)
end
it_behaves_like 'has prometheus integration', 'http://localhost:9090'
......
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