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:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-10-14 13:53:51 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-10-14 15:45:14 +0300
commit5904793ad8ba88d3dfc9c973bcffd1d426db5a33 (patch)
treecd2362b9793d698a3bf2e8de467bc2a9a3a8ada0 /spec/workers/build_finished_worker_spec.rb
parentb8003aa012843fac1745c94788b993c36570fbd9 (diff)
Add build finished worker that creates a workflow
Diffstat (limited to 'spec/workers/build_finished_worker_spec.rb')
-rw-r--r--spec/workers/build_finished_worker_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/workers/build_finished_worker_spec.rb b/spec/workers/build_finished_worker_spec.rb
new file mode 100644
index 00000000000..2868167c7d4
--- /dev/null
+++ b/spec/workers/build_finished_worker_spec.rb
@@ -0,0 +1,30 @@
+require 'spec_helper'
+
+describe BuildFinishedWorker do
+ describe '#perform' do
+ context 'when build exists' do
+ let(:build) { create(:ci_build) }
+
+ it 'calculates coverage and calls hooks' do
+ expect(BuildCoverageWorker)
+ .to receive(:new).ordered.and_call_original
+ expect(BuildHooksWorker)
+ .to receive(:new).ordered.and_call_original
+
+ expect_any_instance_of(BuildCoverageWorker)
+ .to receive(:perform)
+ expect_any_instance_of(BuildHooksWorker)
+ .to receive(:perform)
+
+ described_class.new.perform(build.id)
+ 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