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>2020-02-11 18:08:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-11 18:08:44 +0300
commitbcc77054ee9aefd1e332e04a4189390fd5a3112e (patch)
treee6e1908c310e4733038794e932196cae0d66ba9a /spec/workers/incident_management
parent05b5c609cb8c260b10c2eb1b92b711dc82d32c3f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers/incident_management')
-rw-r--r--spec/workers/incident_management/process_alert_worker_spec.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/workers/incident_management/process_alert_worker_spec.rb b/spec/workers/incident_management/process_alert_worker_spec.rb
new file mode 100644
index 00000000000..9f40833dfd7
--- /dev/null
+++ b/spec/workers/incident_management/process_alert_worker_spec.rb
@@ -0,0 +1,39 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe IncidentManagement::ProcessAlertWorker do
+ let_it_be(:project) { create(:project) }
+
+ describe '#perform' do
+ let(:alert) { :alert }
+ let(:create_issue_service) { spy(:create_issue_service) }
+
+ subject { described_class.new.perform(project.id, alert) }
+
+ it 'calls create issue service' do
+ expect(Project).to receive(:find_by_id).and_call_original
+
+ expect(IncidentManagement::CreateIssueService)
+ .to receive(:new).with(project, :alert)
+ .and_return(create_issue_service)
+
+ expect(create_issue_service).to receive(:execute)
+
+ subject
+ end
+
+ context 'with invalid project' do
+ let(:invalid_project_id) { 0 }
+
+ subject { described_class.new.perform(invalid_project_id, alert) }
+
+ it 'does not create issues' do
+ expect(Project).to receive(:find_by_id).and_call_original
+ expect(IncidentManagement::CreateIssueService).not_to receive(:new)
+
+ subject
+ end
+ end
+ end
+end