diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 09:45:46 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 09:45:46 +0000 |
commit | a7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch) | |
tree | 7452bd5c3545c2fa67a28aa013835fb4fa071baf /spec/services/alert_management | |
parent | ee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff) | |
download | gitlab-ce-a7b3560714b4d9cc4ab32dffcd1f74a284b93580.tar.gz |
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'spec/services/alert_management')
-rw-r--r-- | spec/services/alert_management/alerts/update_service_spec.rb | 13 | ||||
-rw-r--r-- | spec/services/alert_management/create_alert_issue_service_spec.rb | 4 |
2 files changed, 13 insertions, 4 deletions
diff --git a/spec/services/alert_management/alerts/update_service_spec.rb b/spec/services/alert_management/alerts/update_service_spec.rb index 35697ac79a0..882543fd701 100644 --- a/spec/services/alert_management/alerts/update_service_spec.rb +++ b/spec/services/alert_management/alerts/update_service_spec.rb @@ -28,8 +28,11 @@ RSpec.describe AlertManagement::Alerts::UpdateService do specify { expect { response }.not_to change(Note, :count) } end - shared_examples 'adds a system note' do - specify { expect { response }.to change { alert.reload.notes.count }.by(1) } + shared_examples 'adds a system note' do |note_matcher = nil| + specify do + expect { response }.to change { alert.reload.notes.count }.by(1) + expect(alert.notes.last.note).to match(note_matcher) if note_matcher + end end shared_examples 'error response' do |message| @@ -288,6 +291,12 @@ RSpec.describe AlertManagement::Alerts::UpdateService do end end end + + context 'when a status change reason is included' do + let(:params) { { status: new_status, status_change_reason: ' by changing the incident status' } } + + it_behaves_like 'adds a system note', /changed the status to \*\*Acknowledged\*\* by changing the incident status/ + end end end end diff --git a/spec/services/alert_management/create_alert_issue_service_spec.rb b/spec/services/alert_management/create_alert_issue_service_spec.rb index 55f8e47717c..083e5b8c6f1 100644 --- a/spec/services/alert_management/create_alert_issue_service_spec.rb +++ b/spec/services/alert_management/create_alert_issue_service_spec.rb @@ -43,10 +43,10 @@ RSpec.describe AlertManagement::CreateAlertIssueService do expect(execute).to be_success end - it 'updates alert.issue_id' do + it 'sets alert.issue_id in the same ActiveRecord query execution' do execute - expect(alert.reload.issue_id).to eq(created_issue.id) + expect(alert.issue_id).to eq(created_issue.id) end it 'creates a system note' do |