Skip to content
代码片段 群组 项目
提交 2f817b54 编辑于 作者: Siddharth Asthana's avatar Siddharth Asthana
浏览文件

Fix Rails/SaveBang offenses

Changelog: other
上级 fc586beb
No related branches found
No related tags found
无相关合并请求
...@@ -70,9 +70,3 @@ Rails/SaveBang: ...@@ -70,9 +70,3 @@ Rails/SaveBang:
- spec/lib/gitlab/import_export/snippets_repo_restorer_spec.rb - 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/snippets_repo_saver_spec.rb
- spec/lib/gitlab/import_export/uploads_manager_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 @@ ...@@ -32,7 +32,7 @@
end end
it 'copies the uploads to the export path' do 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) } uploads = Dir.glob(File.join(shared.export_path, 'uploads/**/*')).map { |file| File.basename(file) }
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
end end
it 'copies the uploads to the export path' do 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) } uploads = Dir.glob(File.join(shared.export_path, 'uploads/**/*')).map { |file| File.basename(file) }
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
context 'when private key is saved in settings' do context 'when private key is saved in settings' do
let!(:saved_private_key) do let!(:saved_private_key) do
key = OpenSSL::PKey::RSA.new(4096).to_pem 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 key
end end
......
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
context 'without access to the project', :sidekiq_inline do context 'without access to the project', :sidekiq_inline do
before do before do
project.team.find_member(current_user).destroy project.team.find_member(current_user).destroy!
end end
it_behaves_like 'unauthorized' it_behaves_like 'unauthorized'
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
let(:shards) { %w(foo bar) } let(:shards) { %w(foo bar) }
before do before do
described_class.update(shards) described_class.update(shards) # rubocop:disable Rails/SaveBang
end end
describe '.clear' do describe '.clear' do
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
it 'replaces the existing set' do it 'replaces the existing set' do
new_set = %w(test me more) 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) expect(described_class.cached_healthy_shards).to match_array(new_set)
end end
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
end end
it 'returns 0 if no shards are available' do 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) expect(described_class.healthy_shard_count).to eq(0)
end end
......
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
subject { described_class.issue_due_email(recipient.id, issue.id) } subject { described_class.issue_due_email(recipient.id, issue.id) }
before do before do
issue.update(due_date: Date.tomorrow) issue.update!(due_date: Date.tomorrow)
end end
it_behaves_like 'an answer to an existing thread with reply-by-email enabled' do it_behaves_like 'an answer to an existing thread with reply-by-email enabled' do
...@@ -1229,7 +1229,7 @@ def create_note ...@@ -1229,7 +1229,7 @@ def create_note
end end
context 'when a comment on an existing discussion' do 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) } let(:note) { create(model, author: note_author, noteable: nil, in_reply_to: first_note) }
it 'contains an introduction' do it 'contains an introduction' do
...@@ -1505,7 +1505,7 @@ def invite_to_group(group, inviter:, user: nil, tasks_to_be_done: []) ...@@ -1505,7 +1505,7 @@ def invite_to_group(group, inviter:, user: nil, tasks_to_be_done: [])
context 'member is not created by a user' do context 'member is not created by a user' do
before do before do
group_member.update(created_by: nil) group_member.update!(created_by: nil)
end end
it_behaves_like 'no email is sent' it_behaves_like 'no email is sent'
...@@ -1513,7 +1513,7 @@ def invite_to_group(group, inviter:, user: nil, tasks_to_be_done: []) ...@@ -1513,7 +1513,7 @@ def invite_to_group(group, inviter:, user: nil, tasks_to_be_done: [])
context 'member is a known user' do context 'member is a known user' do
before do before do
group_member.update(user: create(:user)) group_member.update!(user: create(:user))
end end
it_behaves_like 'no email is sent' it_behaves_like 'no email is sent'
...@@ -1737,7 +1737,7 @@ def invite_to_group(group, inviter:, user: nil, tasks_to_be_done: []) ...@@ -1737,7 +1737,7 @@ def invite_to_group(group, inviter:, user: nil, tasks_to_be_done: [])
stub_config_setting(email_subject_suffix: 'A Nice Suffix') stub_config_setting(email_subject_suffix: 'A Nice Suffix')
perform_enqueued_jobs do perform_enqueued_jobs do
user.email = "new-email@mail.com" user.email = "new-email@mail.com"
user.save user.save!
end end
end end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册