diff options
Diffstat (limited to 'spec/workers/pipeline_hooks_worker_spec.rb')
-rw-r--r-- | spec/workers/pipeline_hooks_worker_spec.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/spec/workers/pipeline_hooks_worker_spec.rb b/spec/workers/pipeline_hooks_worker_spec.rb index 0ed00c0c66a..13a86c3d4fe 100644 --- a/spec/workers/pipeline_hooks_worker_spec.rb +++ b/spec/workers/pipeline_hooks_worker_spec.rb @@ -8,8 +8,10 @@ RSpec.describe PipelineHooksWorker do let(:pipeline) { create(:ci_pipeline) } it 'executes hooks for the pipeline' do - expect_any_instance_of(Ci::Pipeline) - .to receive(:execute_hooks) + hook_service = double + + expect(Ci::Pipelines::HookService).to receive(:new).and_return(hook_service) + expect(hook_service).to receive(:execute) described_class.new.perform(pipeline.id) end @@ -17,6 +19,8 @@ RSpec.describe PipelineHooksWorker do context 'when pipeline does not exist' do it 'does not raise exception' do + expect(Ci::Pipelines::HookService).not_to receive(:new) + expect { described_class.new.perform(123) } .not_to raise_error end |