summaryrefslogtreecommitdiff
path: root/spec/workers
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-10-13 12:58:25 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-10-13 12:58:25 +0200
commit204fdcb1abb9c76b2d4bd6260c6e5ce91529aeb8 (patch)
tree0e62bd21453b627ae74139c985cd0faec623479b /spec/workers
parentfafc5a1777484ba6b1b12c5e88f3fc783fb4d839 (diff)
downloadgitlab-ce-204fdcb1abb9c76b2d4bd6260c6e5ce91529aeb8.tar.gz
Add build success worker that runs asynchronously
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/build_success_worker_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/workers/build_success_worker_spec.rb b/spec/workers/build_success_worker_spec.rb
new file mode 100644
index 00000000000..c42bcd45d50
--- /dev/null
+++ b/spec/workers/build_success_worker_spec.rb
@@ -0,0 +1,25 @@
+require 'spec_helper'
+
+describe BuildSuccessWorker do
+ describe '#perform' do
+ context 'when build exists' do
+ context 'when build belogs to the environment' do
+ let!(:build) { create(:ci_build, environment: 'production') }
+
+ it 'executes deployment service' do
+ expect_any_instance_of(CreateDeploymentService)
+ .to receive(:execute)
+
+ described_class.new.perform(build.id)
+ end
+ end
+ end
+
+ context 'when build does not exist' do
+ it 'does not raise exception' do
+ expect { described_class.new.perform(123) }
+ .not_to raise_error
+ end
+ end
+ end
+end