Commit e57ab5dd authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'issue_220040_7' into 'master'

Fix Rails/SaveBang offenses for ee/spec/services - I

See merge request gitlab-org/gitlab!75968
parents ec513224 011d417c
......@@ -38,13 +38,6 @@ Rails/SaveBang:
- ee/spec/models/visible_approvable_spec.rb
- ee/spec/models/vulnerabilities/feedback_spec.rb
- ee/spec/models/vulnerabilities/issue_link_spec.rb
- ee/spec/services/ee/boards/issues/create_service_spec.rb
- ee/spec/services/ee/boards/issues/list_service_spec.rb
- ee/spec/services/ee/boards/lists/list_service_spec.rb
- ee/spec/services/ee/issuable/clone/attributes_rewriter_spec.rb
- ee/spec/services/ee/issuable/common_system_notes_service_spec.rb
- ee/spec/services/ee/issues/update_service_spec.rb
- ee/spec/services/ee/merge_requests/refresh_service_spec.rb
- ee/spec/services/ee/merge_requests/update_service_spec.rb
- ee/spec/services/ee/notes/quick_actions_service_spec.rb
- ee/spec/services/ee/notification_service_spec.rb
......
......@@ -40,7 +40,7 @@ RSpec.describe Boards::Issues::CreateService do
context 'when board is scoped by weight' do
it 'creates issue weight 0 weight' do
board.update(weight: 0)
board.update!(weight: 0)
issue = service.execute
......@@ -49,7 +49,7 @@ RSpec.describe Boards::Issues::CreateService do
end
it 'creates issue with nil weight' do
board.update(weight: nil)
board.update!(weight: nil)
issue = service.execute
......@@ -59,7 +59,7 @@ RSpec.describe Boards::Issues::CreateService do
context 'when board weight is invalid' do
it 'creates issue with nil weight' do
board.update(weight: -1)
board.update!(weight: -1)
issue = service.execute
......
......@@ -161,7 +161,7 @@ RSpec.describe Boards::Issues::ListService, services: true do
context 'as upcoming' do
before do
board.update(milestone_id: Milestone::Upcoming.id)
board.update!(milestone_id: Milestone::Upcoming.id)
end
it 'returns open issue for backlog without board label or assignees' do
......@@ -173,7 +173,7 @@ RSpec.describe Boards::Issues::ListService, services: true do
context 'as started' do
before do
board.update(milestone_id: Milestone::Started.id)
board.update!(milestone_id: Milestone::Started.id)
end
it 'returns open issue for backlog without board label or assignees' do
......
......@@ -13,7 +13,7 @@ RSpec.describe Boards::Lists::ListService do
end
shared_examples 'list service for board with assignee lists' do
let!(:assignee_list) { build(:user_list, board: board).tap { |l| l.save(validate: false) } }
let!(:assignee_list) { build(:user_list, board: board).tap { |l| l.save!(validate: false) } }
let!(:backlog_list) { create(:backlog_list, board: board) }
let!(:list) { create(:list, board: board, label: label) }
......@@ -35,7 +35,7 @@ RSpec.describe Boards::Lists::ListService do
end
shared_examples 'list service for board with milestone lists' do
let!(:milestone_list) { build(:milestone_list, board: board).tap { |l| l.save(validate: false) } }
let!(:milestone_list) { build(:milestone_list, board: board).tap { |l| l.save!(validate: false) } }
let!(:backlog_list) { create(:backlog_list, board: board) }
let!(:list) { create(:list, board: board, label: label) }
......@@ -58,7 +58,7 @@ RSpec.describe Boards::Lists::ListService do
end
shared_examples 'list service for board with iteration lists' do
let!(:iteration_list) { build(:iteration_list, board: board).tap { |l| l.save(validate: false) } }
let!(:iteration_list) { build(:iteration_list, board: board).tap { |l| l.save!(validate: false) } }
let!(:backlog_list) { create(:backlog_list, board: board) }
let!(:list) { create(:list, board: board, label: label) }
......
......@@ -21,7 +21,7 @@ RSpec.describe Issuable::Clone::AttributesRewriter do
let!(:group_label2) { create(:group_label, title: 'label2', group: group) }
it 'keeps group labels and merges project labels where possible' do
original_issue.update(labels: [project_label1, project_label2, group_label1])
original_issue.update!(labels: [project_label1, project_label2, group_label1])
subject.execute
......@@ -32,7 +32,7 @@ RSpec.describe Issuable::Clone::AttributesRewriter do
context 'setting milestones' do
it 'ignores milestone attribute' do
milestone = create(:milestone, title: 'milestone', group: group)
original_issue.update(milestone: milestone)
original_issue.update!(milestone: milestone)
expect(new_epic).to receive(:update).with(labels: [])
......@@ -47,7 +47,7 @@ RSpec.describe Issuable::Clone::AttributesRewriter do
it 'ignores issue_id attribute' do
milestone = create(:milestone, title: 'milestone', group: group)
original_issue.update(milestone: milestone)
original_issue.update!(milestone: milestone)
subject.execute
......
......@@ -76,7 +76,7 @@ RSpec.describe Issuable::CommonSystemNotesService do
before do
issuable.assign_attributes(start_date: timestamp, end_date: nil)
issuable.save
issuable.save!
end
it 'creates 2 system notes with the correct content' do
......@@ -96,7 +96,7 @@ RSpec.describe Issuable::CommonSystemNotesService do
subject { described_class.new(project: project, current_user: user).execute(issuable, old_labels: [], is_update: false) }
before do
issuable.update(weight: 5, health_status: 'at_risk')
issuable.update!(weight: 5, health_status: 'at_risk')
end
it 'creates a resource weight event' do
......
......@@ -277,7 +277,7 @@ RSpec.describe MergeRequests::RefreshService do
before do
project.add_developer(current_user)
project.update(merge_pipelines_enabled: true)
project.update!(merge_pipelines_enabled: true)
stub_licensed_features(merge_pipelines: true)
stub_ci_pipeline_yaml_file(YAML.dump(config))
end
......@@ -332,14 +332,14 @@ RSpec.describe MergeRequests::RefreshService do
before do
group.add_owner(user)
merge_request.approvals.create(user_id: user.id)
forked_merge_request.approvals.create(user_id: user.id)
merge_request.approvals.create!(user_id: user.id)
forked_merge_request.approvals.create!(user_id: user.id)
project.add_developer(approver)
perform_enqueued_jobs do
merge_request.update(approver_ids: [approver].map(&:id).join(','))
forked_merge_request.update(approver_ids: [approver].map(&:id).join(','))
merge_request.update!(approver_ids: [approver].map(&:id).join(','))
forked_merge_request.update!(approver_ids: [approver].map(&:id).join(','))
end
end
......@@ -436,7 +436,7 @@ RSpec.describe MergeRequests::RefreshService do
context 'push to origin repo target branch after fork project was removed' do
before do
forked_project.destroy
forked_project.destroy!
service.execute(oldrev, newrev, 'refs/heads/feature')
reload_mrs
end
......@@ -452,7 +452,7 @@ RSpec.describe MergeRequests::RefreshService do
context 'resetting approvals if they are enabled', :sidekiq_inline do
context 'when approvals_before_merge is disabled' do
before do
project.update(approvals_before_merge: 0)
project.update!(approvals_before_merge: 0)
allow(service).to receive(:execute_hooks)
service.execute(oldrev, newrev, 'refs/heads/master')
reload_mrs
......@@ -466,7 +466,7 @@ RSpec.describe MergeRequests::RefreshService do
context 'when reset_approvals_on_push is disabled' do
before do
project.update(reset_approvals_on_push: false)
project.update!(reset_approvals_on_push: false)
allow(service).to receive(:execute_hooks)
service.execute(oldrev, newrev, 'refs/heads/master')
reload_mrs
......@@ -480,7 +480,7 @@ RSpec.describe MergeRequests::RefreshService do
context 'when the rebase_commit_sha on the MR matches the pushed SHA' do
before do
merge_request.update(rebase_commit_sha: newrev)
merge_request.update!(rebase_commit_sha: newrev)
allow(service).to receive(:execute_hooks)
service.execute(oldrev, newrev, 'refs/heads/master')
reload_mrs
......
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