summaryrefslogtreecommitdiff
path: root/spec/services/incident_management/issuable_escalation_statuses/create_service_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/incident_management/issuable_escalation_statuses/create_service_spec.rb')
-rw-r--r--spec/services/incident_management/issuable_escalation_statuses/create_service_spec.rb23
1 files changed, 19 insertions, 4 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
index 8fbab361ec4..2c7d330766c 100644
--- a/spec/services/incident_management/issuable_escalation_statuses/create_service_spec.rb
+++ b/spec/services/incident_management/issuable_escalation_statuses/create_service_spec.rb
@@ -8,12 +8,12 @@ RSpec.describe IncidentManagement::IssuableEscalationStatuses::CreateService do
let(:incident) { create(:incident, project: project) }
let(:service) { described_class.new(incident) }
- subject(:execute) { service.execute}
+ 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)
+ expect { execute }.to change { incident.reload.escalation_status }.from(nil)
- status = incident.incident_management_issuable_escalation_status
+ status = incident.escalation_status
expect(status.policy_id).to eq(nil)
expect(status.escalations_started_at).to eq(nil)
@@ -24,7 +24,22 @@ RSpec.describe IncidentManagement::IssuableEscalationStatuses::CreateService 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 }
+ expect { execute }.not_to change { incident.reload.escalation_status }
+ end
+ end
+
+ context 'with associated alert' do
+ before do
+ create(:alert_management_alert, :acknowledged, project: project, issue: incident)
+ end
+
+ it 'creates an escalation status matching the alert attributes' do
+ expect { execute }.to change { incident.reload.escalation_status }.from(nil)
+ expect(incident.escalation_status).to have_attributes(
+ status_name: :acknowledged,
+ policy_id: nil,
+ escalations_started_at: nil
+ )
end
end
end