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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-12-17 15:16:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-17 15:16:21 +0300
commit5d92a0af93588db9c6bef9ab5d81b73daebc782a (patch)
treec77e1c9c1a80e91de5d3e04c48d5082a971920be /spec/services
parent4a52a162d1b5c7dfe7b0ef90f42fd39e4bb2a863 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/incident_management/issuable_escalation_statuses/create_service_spec.rb30
-rw-r--r--spec/services/issues/create_service_spec.rb7
2 files changed, 37 insertions, 0 deletions
diff --git a/spec/services/incident_management/issuable_escalation_statuses/create_service_spec.rb b/spec/services/incident_management/issuable_escalation_statuses/create_service_spec.rb
new file mode 100644
index 00000000000..8fbab361ec4
--- /dev/null
+++ b/spec/services/incident_management/issuable_escalation_statuses/create_service_spec.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe IncidentManagement::IssuableEscalationStatuses::CreateService do
+ let_it_be(:project) { create(:project) }
+
+ let(:incident) { create(:incident, project: project) }
+ let(:service) { described_class.new(incident) }
+
+ subject(:execute) { service.execute}
+
+ it 'creates an escalation status for the incident with no policy set' do
+ expect { execute }.to change { incident.reload.incident_management_issuable_escalation_status }.from(nil)
+
+ status = incident.incident_management_issuable_escalation_status
+
+ expect(status.policy_id).to eq(nil)
+ expect(status.escalations_started_at).to eq(nil)
+ expect(status.status_name).to eq(:triggered)
+ end
+
+ context 'existing escalation status' do
+ let!(:existing_status) { create(:incident_management_issuable_escalation_status, issue: incident) }
+
+ it 'exits without changing anything' do
+ expect { execute }.not_to change { incident.reload.incident_management_issuable_escalation_status }
+ end
+ end
+end
diff --git a/spec/services/issues/create_service_spec.rb b/spec/services/issues/create_service_spec.rb
index 441cd7067e5..8496bd31e00 100644
--- a/spec/services/issues/create_service_spec.rb
+++ b/spec/services/issues/create_service_spec.rb
@@ -108,6 +108,13 @@ RSpec.describe Issues::CreateService do
.to change { Label.where(incident_label_attributes).count }.by(1)
end
+ it 'calls IncidentManagement::Incidents::CreateEscalationStatusService' do
+ expect_next(::IncidentManagement::IssuableEscalationStatuses::CreateService, a_kind_of(Issue))
+ .to receive(:execute)
+
+ issue
+ end
+
context 'when invalid' do
before do
opts.merge!(title: '')