diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-10-04 13:27:48 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-10-04 14:43:58 +0200 |
commit | 4e4640b10bfae9bfa1da265775ede57ea72c358c (patch) | |
tree | 3034df7094e500d1f85fabd40f5204da08fb983b /spec | |
parent | 5ce5abdc1dc53e97cff88f5abfe0edd10211bf9c (diff) | |
download | gitlab-ce-4e4640b10bfae9bfa1da265775ede57ea72c358c.tar.gz |
Add specs for new async ci pipeline workers
Diffstat (limited to 'spec')
-rw-r--r-- | spec/workers/process_pipeline_worker_spec.rb | 22 | ||||
-rw-r--r-- | spec/workers/update_pipeline_worker_spec.rb | 22 |
2 files changed, 44 insertions, 0 deletions
diff --git a/spec/workers/process_pipeline_worker_spec.rb b/spec/workers/process_pipeline_worker_spec.rb new file mode 100644 index 00000000000..7b5f98d5763 --- /dev/null +++ b/spec/workers/process_pipeline_worker_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe ProcessPipelineWorker do + describe '#perform' do + context 'when pipeline exists' do + let(:pipeline) { create(:ci_pipeline) } + + it 'processes pipeline' do + expect_any_instance_of(Ci::Pipeline).to receive(:process!) + + described_class.new.perform(pipeline.id) + end + end + + context 'when pipeline does not exist' do + it 'does not raise exception' do + expect { described_class.new.perform(123) } + .not_to raise_error + end + end + end +end diff --git a/spec/workers/update_pipeline_worker_spec.rb b/spec/workers/update_pipeline_worker_spec.rb new file mode 100644 index 00000000000..fadc42b22f0 --- /dev/null +++ b/spec/workers/update_pipeline_worker_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe UpdatePipelineWorker do + describe '#perform' do + context 'when pipeline exists' do + let(:pipeline) { create(:ci_pipeline) } + + it 'updates pipeline status' do + expect_any_instance_of(Ci::Pipeline).to receive(:update_status) + + described_class.new.perform(pipeline.id) + end + end + + context 'when pipeline does not exist' do + it 'does not raise exception' do + expect { described_class.new.perform(123) } + .not_to raise_error + end + end + end +end |