Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/alert_management/create_alert_issue_service_spec.rb')
-rw-r--r--spec/services/alert_management/create_alert_issue_service_spec.rb27
1 files changed, 27 insertions, 0 deletions
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 2834322be7b..695e90ebd92 100644
--- a/spec/services/alert_management/create_alert_issue_service_spec.rb
+++ b/spec/services/alert_management/create_alert_issue_service_spec.rb
@@ -118,9 +118,36 @@ RSpec.describe AlertManagement::CreateAlertIssueService do
context 'when the alert is generic' do
let(:alert) { generic_alert }
let(:issue) { subject.payload[:issue] }
+ let(:default_alert_title) { described_class::DEFAULT_ALERT_TITLE }
it_behaves_like 'creating an alert issue'
it_behaves_like 'setting an issue attributes'
+
+ context 'when alert title matches the default title exactly' do
+ before do
+ generic_alert.update!(title: default_alert_title)
+ end
+
+ it 'updates issue title with the IID' do
+ execute
+
+ expect(created_issue.title).to eq("New: Incident #{created_issue.iid}")
+ end
+ end
+
+ context 'when the alert title contains the default title' do
+ let(:non_default_alert_title) { "Not #{default_alert_title}" }
+
+ before do
+ generic_alert.update!(title: non_default_alert_title)
+ end
+
+ it 'does not change issue title' do
+ execute
+
+ expect(created_issue.title).to eq(non_default_alert_title)
+ end
+ end
end
context 'when issue cannot be created' do