diff options
Diffstat (limited to 'spec/workers/run_pipeline_schedule_worker_spec.rb')
-rw-r--r-- | spec/workers/run_pipeline_schedule_worker_spec.rb | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/spec/workers/run_pipeline_schedule_worker_spec.rb b/spec/workers/run_pipeline_schedule_worker_spec.rb index bb11d1dbb58..846b4455bf9 100644 --- a/spec/workers/run_pipeline_schedule_worker_spec.rb +++ b/spec/workers/run_pipeline_schedule_worker_spec.rb @@ -10,12 +10,25 @@ RSpec.describe RunPipelineScheduleWorker do let(:worker) { described_class.new } - context 'when a project not found' do + context 'when a schedule not found' do it 'does not call the Service' do expect(Ci::CreatePipelineService).not_to receive(:new) expect(worker).not_to receive(:run_pipeline_schedule) - worker.perform(100000, user.id) + worker.perform(non_existing_record_id, user.id) + end + end + + context 'when a schedule project is missing' do + before do + project.delete + end + + it 'does not call the Service' do + expect(Ci::CreatePipelineService).not_to receive(:new) + expect(worker).not_to receive(:run_pipeline_schedule) + + worker.perform(pipeline_schedule.id, user.id) end end @@ -24,7 +37,7 @@ RSpec.describe RunPipelineScheduleWorker do expect(Ci::CreatePipelineService).not_to receive(:new) expect(worker).not_to receive(:run_pipeline_schedule) - worker.perform(pipeline_schedule.id, 10000) + worker.perform(pipeline_schedule.id, non_existing_record_id) end end |