Commit 1e9c4c5d authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'issue#220040-fix-robocop-savebang-spec-models-1' into 'master'

Fixed offenses in spec/models/* part 2

See merge request gitlab-org/gitlab!61961
parents fcd860c7 780f7e43
......@@ -156,11 +156,7 @@ Rails/SaveBang:
- 'spec/lib/gitlab/shard_health_cache_spec.rb'
- 'spec/mailers/notify_spec.rb'
- 'spec/models/clusters/applications/helm_spec.rb'
- 'spec/models/container_repository_spec.rb'
- 'spec/models/design_management/version_spec.rb'
- 'spec/models/diff_discussion_spec.rb'
- 'spec/models/diff_note_spec.rb'
- 'spec/models/email_spec.rb'
- 'spec/models/environment_spec.rb'
- 'spec/models/event_spec.rb'
- 'spec/models/fork_network_spec.rb'
......
---
title: Fixed Rails Save Bang offenses in few spec/models/* files
merge_request: 61961
author: Suraj Tripathi @surajtripathy07
type: fixed
......@@ -320,7 +320,7 @@ RSpec.describe ContainerRepository do
before do
group.parent = test_group
group.save
group.save!
end
it { is_expected.to contain_exactly(repository, another_repository) }
......
......@@ -21,9 +21,9 @@ RSpec.describe DiffDiscussion do
describe '#merge_request_version_params' do
let(:merge_request) { create(:merge_request, source_project: project, target_project: project, importing: true) }
let!(:merge_request_diff1) { merge_request.merge_request_diffs.create(head_commit_sha: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9') }
let!(:merge_request_diff2) { merge_request.merge_request_diffs.create(head_commit_sha: nil) }
let!(:merge_request_diff3) { merge_request.merge_request_diffs.create(head_commit_sha: '5937ac0a7beb003549fc5fd26fc247adbce4a52e') }
let!(:merge_request_diff1) { merge_request.merge_request_diffs.create!(head_commit_sha: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9') }
let!(:merge_request_diff2) { merge_request.merge_request_diffs.create!(head_commit_sha: nil) }
let!(:merge_request_diff3) { merge_request.merge_request_diffs.create!(head_commit_sha: '5937ac0a7beb003549fc5fd26fc247adbce4a52e') }
context 'when the discussion is active' do
it 'returns an empty hash, which will end up showing the latest version' do
......
......@@ -167,7 +167,7 @@ RSpec.describe DiffNote do
end
it 'creates a diff note file' do
subject.save
subject.save!
expect(subject.note_diff_file).to be_present
end
end
......@@ -188,7 +188,7 @@ RSpec.describe DiffNote do
end
it 'raises an error' do
expect { subject.save }.to raise_error(::DiffNote::NoteDiffFileCreationError,
expect { subject.save! }.to raise_error(::DiffNote::NoteDiffFileCreationError,
"Failed to find diff line for: #{diff_file.file_path}, "\
"old_line: #{position.old_line}"\
", new_line: #{position.new_line}")
......@@ -201,7 +201,7 @@ RSpec.describe DiffNote do
end
it 'creates a diff note file' do
subject.save
subject.save!
expect(subject.reload.note_diff_file).to be_present
end
end
......@@ -544,7 +544,7 @@ RSpec.describe DiffNote do
it "does not update the position" do
expect(subject).not_to receive(:update_position)
subject.save
subject.save!
end
end
......
......@@ -24,7 +24,7 @@ RSpec.describe Email do
let(:user) { create(:user) }
it 'synchronizes the gpg keys when the email is updated' do
email = user.emails.create(email: 'new@email.com')
email = user.emails.create!(email: 'new@email.com')
expect(user).to receive(:update_invalid_gpg_signatures)
......
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