diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 21:10:32 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 21:10:32 +0300 |
commit | 21db5294d4ba402f9d44a1f59e8344daef0911a2 (patch) | |
tree | d888dbe0a42ce86efe9e235602fe5209b196ada7 /spec/services | |
parent | 155f106fd5b5214c387e9b9143e9fa5725daed54 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/issues/update_service_spec.rb | 8 | ||||
-rw-r--r-- | spec/services/system_note_service_spec.rb | 12 | ||||
-rw-r--r-- | spec/services/system_notes/issuables_service_spec.rb | 12 |
3 files changed, 32 insertions, 0 deletions
diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index 29ac7df88eb..0c7f3f7e6e2 100644 --- a/spec/services/issues/update_service_spec.rb +++ b/spec/services/issues/update_service_spec.rb @@ -189,6 +189,14 @@ RSpec.describe Issues::UpdateService, :mailer do expect(issue.labels.pluck(:title)).to eq(['incident']) end + it 'creates system note about issue type' do + update_issue(issue_type: 'incident') + + note = find_note('changed issue type to incident') + + expect(note).not_to eq(nil) + end + context 'for an issue with multiple labels' do let(:issue) { create(:incident, project: project, labels: [label_1]) } diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb index 5aff5149dcf..1a421999ffb 100644 --- a/spec/services/system_note_service_spec.rb +++ b/spec/services/system_note_service_spec.rb @@ -793,4 +793,16 @@ RSpec.describe SystemNoteService do described_class.log_resolving_alert(alert, monitoring_tool) end end + + describe '.change_issue_type' do + let(:incident) { build(:incident) } + + it 'calls IssuableService' do + expect_next_instance_of(::SystemNotes::IssuablesService) do |service| + expect(service).to receive(:change_issue_type) + end + + described_class.change_issue_type(incident, author) + end + end end diff --git a/spec/services/system_notes/issuables_service_spec.rb b/spec/services/system_notes/issuables_service_spec.rb index 1ea3c241d27..71a28a89cd8 100644 --- a/spec/services/system_notes/issuables_service_spec.rb +++ b/spec/services/system_notes/issuables_service_spec.rb @@ -773,4 +773,16 @@ RSpec.describe ::SystemNotes::IssuablesService do expect(event.state).to eq('closed') end end + + describe '#change_issue_type' do + let(:noteable) { create(:incident, project: project) } + + subject { service.change_issue_type } + + it_behaves_like 'a system note' do + let(:action) { 'issue_type' } + end + + it { expect(subject.note).to eq "changed issue type to incident" } + end end |