Commit 6d625f98 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'rails-save-bang-34' into 'master'

Fix Rails/SaveBang offenses for spec files in spec/services/issuable/*

See merge request gitlab-org/gitlab!42780
parents b1f504a6 c3faf68d
...@@ -1139,9 +1139,6 @@ Rails/SaveBang: ...@@ -1139,9 +1139,6 @@ Rails/SaveBang:
- 'spec/services/emails/confirm_service_spec.rb' - 'spec/services/emails/confirm_service_spec.rb'
- 'spec/services/groups/destroy_service_spec.rb' - 'spec/services/groups/destroy_service_spec.rb'
- 'spec/services/groups/import_export/import_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/labels/promote_service_spec.rb'
- 'spec/services/notes/create_service_spec.rb' - 'spec/services/notes/create_service_spec.rb'
- 'spec/services/notification_recipients/build_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 ...@@ -254,7 +254,7 @@ RSpec.describe Issuable::BulkUpdateService do
describe 'unsubscribe from issues' do describe 'unsubscribe from issues' do
let(:issues) do let(:issues) do
create_list(:closed_issue, 2, project: project) do |issue| 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
end end
......
...@@ -20,7 +20,7 @@ RSpec.describe Issuable::Clone::AttributesRewriter do ...@@ -20,7 +20,7 @@ RSpec.describe Issuable::Clone::AttributesRewriter do
group_label = create(:group_label, title: 'group_label', group: group) group_label = create(:group_label, title: 'group_label', group: group)
create(:label, title: 'label3', project: project2) 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 subject.execute
...@@ -48,7 +48,7 @@ RSpec.describe Issuable::Clone::AttributesRewriter do ...@@ -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 it 'sets milestone to nil when old issue milestone is not in the new project' do
milestone = create(:milestone, title: 'milestone', project: project1) milestone = create(:milestone, title: 'milestone', project: project1)
original_issue.update(milestone: milestone) original_issue.update!(milestone: milestone)
subject.execute subject.execute
...@@ -59,7 +59,7 @@ RSpec.describe Issuable::Clone::AttributesRewriter do ...@@ -59,7 +59,7 @@ RSpec.describe Issuable::Clone::AttributesRewriter do
milestone_project1 = create(:milestone, title: 'milestone', project: project1) milestone_project1 = create(:milestone, title: 'milestone', project: project1)
milestone_project2 = create(:milestone, title: 'milestone', project: project2) milestone_project2 = create(:milestone, title: 'milestone', project: project2)
original_issue.update(milestone: milestone_project1) original_issue.update!(milestone: milestone_project1)
subject.execute subject.execute
...@@ -69,7 +69,7 @@ RSpec.describe Issuable::Clone::AttributesRewriter do ...@@ -69,7 +69,7 @@ RSpec.describe Issuable::Clone::AttributesRewriter do
it 'copies the milestone when old issue milestone is a group milestone' do it 'copies the milestone when old issue milestone is a group milestone' do
milestone = create(:milestone, title: 'milestone', group: group) milestone = create(:milestone, title: 'milestone', group: group)
original_issue.update(milestone: milestone) original_issue.update!(milestone: milestone)
subject.execute subject.execute
...@@ -85,7 +85,7 @@ RSpec.describe Issuable::Clone::AttributesRewriter do ...@@ -85,7 +85,7 @@ RSpec.describe Issuable::Clone::AttributesRewriter do
let!(:milestone2_project2) { create(:milestone, title: 'milestone2', project: project2) } let!(:milestone2_project2) { create(:milestone, title: 'milestone2', project: project2) }
before do before do
original_issue.update(milestone: milestone2_project1) original_issue.update!(milestone: milestone2_project1)
create_event(milestone1_project1) create_event(milestone1_project1)
create_event(milestone2_project1) create_event(milestone2_project1)
......
...@@ -19,7 +19,7 @@ RSpec.describe Issuable::CommonSystemNotesService do ...@@ -19,7 +19,7 @@ RSpec.describe Issuable::CommonSystemNotesService do
before do before do
issuable.labels << label issuable.labels << label
issuable.save issuable.save!
end end
it 'creates a resource label event' do it 'creates a resource label event' do
...@@ -69,7 +69,7 @@ RSpec.describe Issuable::CommonSystemNotesService do ...@@ -69,7 +69,7 @@ RSpec.describe Issuable::CommonSystemNotesService do
subject { described_class.new(project, user).execute(issuable, old_labels: [], is_update: false) } subject { described_class.new(project, user).execute(issuable, old_labels: [], is_update: false) }
it 'does not create system note for title and description' do it 'does not create system note for title and description' do
issuable.save issuable.save!
expect { subject }.not_to change { issuable.notes.count } expect { subject }.not_to change { issuable.notes.count }
end end
...@@ -78,7 +78,7 @@ RSpec.describe Issuable::CommonSystemNotesService do ...@@ -78,7 +78,7 @@ RSpec.describe Issuable::CommonSystemNotesService do
label = create(:label, project: project) label = create(:label, project: project)
issuable.labels << label issuable.labels << label
issuable.save issuable.save!
expect { subject }.to change { issuable.resource_label_events.count }.from(0).to(1) expect { subject }.to change { issuable.resource_label_events.count }.from(0).to(1)
...@@ -104,7 +104,7 @@ RSpec.describe Issuable::CommonSystemNotesService do ...@@ -104,7 +104,7 @@ RSpec.describe Issuable::CommonSystemNotesService do
it 'creates a system note for due_date set' do it 'creates a system note for due_date set' do
issuable.due_date = Date.today issuable.due_date = Date.today
issuable.save issuable.save!
expect { subject }.to change { issuable.notes.count }.from(0).to(1) expect { subject }.to change { issuable.notes.count }.from(0).to(1)
expect(issuable.notes.last.note).to match('changed due date') 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