Commit c3faf68d authored by Rajendra Kadam's avatar Rajendra Kadam Committed by Peter Leitzen

Fix Rails/SaveBang offenses

Fixes Rails/SaveBang cop for spec files in spec/services/issuable/*
parent 60e36e72
......@@ -1139,9 +1139,6 @@ Rails/SaveBang:
- 'spec/services/emails/confirm_service_spec.rb'
- 'spec/services/groups/destroy_service_spec.rb'
- 'spec/services/groups/import_export/import_service_spec.rb'
- 'spec/services/issuable/bulk_update_service_spec.rb'
- 'spec/services/issuable/clone/attributes_rewriter_spec.rb'
- 'spec/services/issuable/common_system_notes_service_spec.rb'
- 'spec/services/labels/promote_service_spec.rb'
- 'spec/services/notes/create_service_spec.rb'
- 'spec/services/notification_recipients/build_service_spec.rb'
......
---
title: Fix Rails/SaveBang offenses for spec files in spec/services/issuable/*
merge_request: 42780
author: Rajendra Kadam
type: other
......@@ -254,7 +254,7 @@ RSpec.describe Issuable::BulkUpdateService do
describe 'unsubscribe from issues' do
let(:issues) do
create_list(:closed_issue, 2, project: project) do |issue|
issue.subscriptions.create(user: user, project: project, subscribed: true)
issue.subscriptions.create!(user: user, project: project, subscribed: true)
end
end
......
......@@ -20,7 +20,7 @@ RSpec.describe Issuable::Clone::AttributesRewriter do
group_label = create(:group_label, title: 'group_label', group: group)
create(:label, title: 'label3', project: project2)
original_issue.update(labels: [project1_label_1, project1_label_2, group_label])
original_issue.update!(labels: [project1_label_1, project1_label_2, group_label])
subject.execute
......@@ -48,7 +48,7 @@ RSpec.describe Issuable::Clone::AttributesRewriter do
it 'sets milestone to nil when old issue milestone is not in the new project' do
milestone = create(:milestone, title: 'milestone', project: project1)
original_issue.update(milestone: milestone)
original_issue.update!(milestone: milestone)
subject.execute
......@@ -59,7 +59,7 @@ RSpec.describe Issuable::Clone::AttributesRewriter do
milestone_project1 = create(:milestone, title: 'milestone', project: project1)
milestone_project2 = create(:milestone, title: 'milestone', project: project2)
original_issue.update(milestone: milestone_project1)
original_issue.update!(milestone: milestone_project1)
subject.execute
......@@ -69,7 +69,7 @@ RSpec.describe Issuable::Clone::AttributesRewriter do
it 'copies the milestone when old issue milestone is a group milestone' do
milestone = create(:milestone, title: 'milestone', group: group)
original_issue.update(milestone: milestone)
original_issue.update!(milestone: milestone)
subject.execute
......@@ -85,7 +85,7 @@ RSpec.describe Issuable::Clone::AttributesRewriter do
let!(:milestone2_project2) { create(:milestone, title: 'milestone2', project: project2) }
before do
original_issue.update(milestone: milestone2_project1)
original_issue.update!(milestone: milestone2_project1)
create_event(milestone1_project1)
create_event(milestone2_project1)
......
......@@ -19,7 +19,7 @@ RSpec.describe Issuable::CommonSystemNotesService do
before do
issuable.labels << label
issuable.save
issuable.save!
end
it 'creates a resource label event' do
......@@ -69,7 +69,7 @@ RSpec.describe Issuable::CommonSystemNotesService do
subject { described_class.new(project, user).execute(issuable, old_labels: [], is_update: false) }
it 'does not create system note for title and description' do
issuable.save
issuable.save!
expect { subject }.not_to change { issuable.notes.count }
end
......@@ -78,7 +78,7 @@ RSpec.describe Issuable::CommonSystemNotesService do
label = create(:label, project: project)
issuable.labels << label
issuable.save
issuable.save!
expect { subject }.to change { issuable.resource_label_events.count }.from(0).to(1)
......@@ -104,7 +104,7 @@ RSpec.describe Issuable::CommonSystemNotesService do
it 'creates a system note for due_date set' do
issuable.due_date = Date.today
issuable.save
issuable.save!
expect { subject }.to change { issuable.notes.count }.from(0).to(1)
expect(issuable.notes.last.note).to match('changed due date')
......
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