diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-17 14:33:21 +0300 |
commit | 7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch) | |
tree | 5bdc2229f5198d516781f8d24eace62fc7e589e9 /spec/workers/incident_management/add_severity_system_note_worker_spec.rb | |
parent | 185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff) |
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'spec/workers/incident_management/add_severity_system_note_worker_spec.rb')
-rw-r--r-- | spec/workers/incident_management/add_severity_system_note_worker_spec.rb | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/spec/workers/incident_management/add_severity_system_note_worker_spec.rb b/spec/workers/incident_management/add_severity_system_note_worker_spec.rb index bda6f729759..4d6e6610a92 100644 --- a/spec/workers/incident_management/add_severity_system_note_worker_spec.rb +++ b/spec/workers/incident_management/add_severity_system_note_worker_spec.rb @@ -14,28 +14,41 @@ RSpec.describe IncidentManagement::AddSeveritySystemNoteWorker do subject(:perform) { described_class.new.perform(incident_id, user_id) } - shared_examples 'does not add a system note' do + shared_examples 'does not add anything' do it 'does not change incident notes count' do expect { perform }.not_to change { incident.notes.count } end + + it 'does not create a timeline event' do + expect(IncidentManagement::TimelineEvents::CreateService).not_to receive(:change_severity) + perform + end end context 'when incident and user exist' do it 'creates a system note' do expect { perform }.to change { incident.notes.where(author: user).count }.by(1) end + + it 'creates a timeline event' do + expect(IncidentManagement::TimelineEvents::CreateService) + .to receive(:change_severity) + .with(incident, user) + .and_call_original + perform + end end context 'when incident does not exist' do let(:incident_id) { -1 } - it_behaves_like 'does not add a system note' + it_behaves_like 'does not add anything' end context 'when incident_id is nil' do let(:incident_id) { nil } - it_behaves_like 'does not add a system note' + it_behaves_like 'does not add anything' end context 'when issue is not an incident' do @@ -43,19 +56,19 @@ RSpec.describe IncidentManagement::AddSeveritySystemNoteWorker do let(:incident_id) { issue.id } - it_behaves_like 'does not add a system note' + it_behaves_like 'does not add anything' end context 'when user does not exist' do let(:user_id) { -1 } - it_behaves_like 'does not add a system note' + it_behaves_like 'does not add anything' end context 'when user_id is nil' do let(:user_id) { nil } - it_behaves_like 'does not add a system note' + it_behaves_like 'does not add anything' end end end |