Commit b6dc6708 authored by Fabio Pitino's avatar Fabio Pitino

Merge branch 'issue_220040_18' into 'master'

Fix Rails/SaveBang offenses

See merge request gitlab-org/gitlab!75988
parents 75232036 2f817b54
......@@ -50,9 +50,3 @@ Rails/SaveBang:
- spec/lib/gitlab/import_export/snippets_repo_restorer_spec.rb
- spec/lib/gitlab/import_export/snippets_repo_saver_spec.rb
- spec/lib/gitlab/import_export/uploads_manager_spec.rb
- spec/lib/gitlab/import_export/uploads_saver_spec.rb
- spec/lib/gitlab/import_export/wiki_restorer_spec.rb
- spec/lib/gitlab/lets_encrypt/client_spec.rb
- spec/lib/gitlab/middleware/go_spec.rb
- spec/lib/gitlab/shard_health_cache_spec.rb
- spec/mailers/notify_spec.rb
......@@ -32,7 +32,7 @@ RSpec.describe Gitlab::ImportExport::UploadsSaver do
end
it 'copies the uploads to the export path' do
saver.save
saver.save # rubocop:disable Rails/SaveBang
uploads = Dir.glob(File.join(shared.export_path, 'uploads/**/*')).map { |file| File.basename(file) }
......@@ -54,7 +54,7 @@ RSpec.describe Gitlab::ImportExport::UploadsSaver do
end
it 'copies the uploads to the export path' do
saver.save
saver.save # rubocop:disable Rails/SaveBang
uploads = Dir.glob(File.join(shared.export_path, 'uploads/**/*')).map { |file| File.basename(file) }
......
......@@ -42,7 +42,7 @@ RSpec.describe ::Gitlab::LetsEncrypt::Client do
context 'when private key is saved in settings' do
let!(:saved_private_key) do
key = OpenSSL::PKey::RSA.new(4096).to_pem
Gitlab::CurrentSettings.current_application_settings.update(lets_encrypt_private_key: key)
Gitlab::CurrentSettings.current_application_settings.update!(lets_encrypt_private_key: key)
key
end
......
......@@ -100,7 +100,7 @@ RSpec.describe Gitlab::Middleware::Go do
context 'without access to the project', :sidekiq_inline do
before do
project.team.find_member(current_user).destroy
project.team.find_member(current_user).destroy!
end
it_behaves_like 'unauthorized'
......
......@@ -6,7 +6,7 @@ RSpec.describe Gitlab::ShardHealthCache, :clean_gitlab_redis_cache do
let(:shards) { %w(foo bar) }
before do
described_class.update(shards)
described_class.update(shards) # rubocop:disable Rails/SaveBang
end
describe '.clear' do
......@@ -24,7 +24,7 @@ RSpec.describe Gitlab::ShardHealthCache, :clean_gitlab_redis_cache do
it 'replaces the existing set' do
new_set = %w(test me more)
described_class.update(new_set)
described_class.update(new_set) # rubocop:disable Rails/SaveBang
expect(described_class.cached_healthy_shards).to match_array(new_set)
end
......@@ -36,7 +36,7 @@ RSpec.describe Gitlab::ShardHealthCache, :clean_gitlab_redis_cache do
end
it 'returns 0 if no shards are available' do
described_class.update([])
described_class.update([]) # rubocop:disable Rails/SaveBang
expect(described_class.healthy_shard_count).to eq(0)
end
......
......@@ -213,7 +213,7 @@ RSpec.describe Notify do
subject { described_class.issue_due_email(recipient.id, issue.id) }
before do
issue.update(due_date: Date.tomorrow)
issue.update!(due_date: Date.tomorrow)
end
it_behaves_like 'an answer to an existing thread with reply-by-email enabled' do
......@@ -1229,7 +1229,7 @@ RSpec.describe Notify do
end
context 'when a comment on an existing discussion' do
let(:first_note) { create(model) }
let(:first_note) { create(model) } # rubocop:disable Rails/SaveBang
let(:note) { create(model, author: note_author, noteable: nil, in_reply_to: first_note) }
it 'contains an introduction' do
......@@ -1505,7 +1505,7 @@ RSpec.describe Notify do
context 'member is not created by a user' do
before do
group_member.update(created_by: nil)
group_member.update!(created_by: nil)
end
it_behaves_like 'no email is sent'
......@@ -1513,7 +1513,7 @@ RSpec.describe Notify do
context 'member is a known user' do
before do
group_member.update(user: create(:user))
group_member.update!(user: create(:user))
end
it_behaves_like 'no email is sent'
......@@ -1737,7 +1737,7 @@ RSpec.describe Notify do
stub_config_setting(email_subject_suffix: 'A Nice Suffix')
perform_enqueued_jobs do
user.email = "new-email@mail.com"
user.save
user.save!
end
end
......
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