summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/services/alert_management_shared_examples.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/shared_examples/services/alert_management_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/services/alert_management_shared_examples.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/support/shared_examples/services/alert_management_shared_examples.rb b/spec/support/shared_examples/services/alert_management_shared_examples.rb
index a1354a8099b..1ae74979b7a 100644
--- a/spec/support/shared_examples/services/alert_management_shared_examples.rb
+++ b/spec/support/shared_examples/services/alert_management_shared_examples.rb
@@ -39,3 +39,41 @@ RSpec.shared_examples 'adds an alert management alert event' do
subject
end
end
+
+RSpec.shared_examples 'processes incident issues' do
+ let(:create_incident_service) { spy }
+
+ before do
+ allow_any_instance_of(AlertManagement::Alert).to receive(:execute_services)
+ end
+
+ it 'processes issues' do
+ expect(IncidentManagement::ProcessAlertWorker)
+ .to receive(:perform_async)
+ .with(nil, nil, kind_of(Integer))
+ .once
+
+ Sidekiq::Testing.inline! do
+ expect(subject).to be_success
+ end
+ end
+end
+
+RSpec.shared_examples 'does not process incident issues' do
+ it 'does not process issues' do
+ expect(IncidentManagement::ProcessAlertWorker)
+ .not_to receive(:perform_async)
+
+ expect(subject).to be_success
+ end
+end
+
+RSpec.shared_examples 'does not process incident issues due to error' do |http_status:|
+ it 'does not process issues' do
+ expect(IncidentManagement::ProcessAlertWorker)
+ .not_to receive(:perform_async)
+
+ expect(subject).to be_error
+ expect(subject.http_status).to eq(http_status)
+ end
+end