diff options
author | Stan Hu <stanhu@gmail.com> | 2017-12-05 22:24:20 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-12-12 15:07:23 -0800 |
commit | f6966cfa63fab7e3c8847d69101c6c6a444fb85f (patch) | |
tree | d26bcf1a227a13fa49388f7a49e39a5eb1e0fbb7 /spec | |
parent | 8e7f19c60bea4eec86844be1e0db12ebf30f105e (diff) | |
download | gitlab-ce-f6966cfa63fab7e3c8847d69101c6c6a444fb85f.tar.gz |
Address some comments with running a pipeline schedule
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/projects/pipeline_schedules_controller_spec.rb | 4 | ||||
-rw-r--r-- | spec/workers/run_pipeline_schedule_worker_spec.rb | 15 |
2 files changed, 11 insertions, 8 deletions
diff --git a/spec/controllers/projects/pipeline_schedules_controller_spec.rb b/spec/controllers/projects/pipeline_schedules_controller_spec.rb index 384a407a100..e875f5bce08 100644 --- a/spec/controllers/projects/pipeline_schedules_controller_spec.rb +++ b/spec/controllers/projects/pipeline_schedules_controller_spec.rb @@ -364,7 +364,7 @@ describe Projects::PipelineSchedulesController do end end - describe 'POST #run' do + describe 'POST #play' do set(:user) { create(:user) } context 'when a developer makes the request' do @@ -384,7 +384,7 @@ describe Projects::PipelineSchedulesController do end def go - post :run, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id + post :play, namespace_id: project.namespace.to_param, project_id: project, id: pipeline_schedule.id end end diff --git a/spec/workers/run_pipeline_schedule_worker_spec.rb b/spec/workers/run_pipeline_schedule_worker_spec.rb index 4a88ac51f62..481a84837f9 100644 --- a/spec/workers/run_pipeline_schedule_worker_spec.rb +++ b/spec/workers/run_pipeline_schedule_worker_spec.rb @@ -2,27 +2,30 @@ require 'spec_helper' describe RunPipelineScheduleWorker do describe '#perform' do - let(:project) { create(:project) } + set(:project) { create(:project) } + set(:user) { create(:user) } + set(:pipeline_schedule) { create(:ci_pipeline_schedule, :nightly, project: project ) } let(:worker) { described_class.new } - let(:user) { create(:user) } - let(:pipeline_schedule) { create(:ci_pipeline_schedule, :nightly, project: project ) } context 'when a project not found' do it 'does not call the Service' do expect(Ci::CreatePipelineService).not_to receive(:new) - expect { worker.perform(100000, user.id) }.to raise_error(ActiveRecord::RecordNotFound) + expect(worker).not_to receive(:run_pipeline_schedule) + + worker.perform(100000, user.id) end end context 'when a user not found' do it 'does not call the Service' do expect(Ci::CreatePipelineService).not_to receive(:new) - expect { worker.perform(pipeline_schedule.id, 10000) }.to raise_error(ActiveRecord::RecordNotFound) + expect(worker).not_to receive(:run_pipeline_schedule) + + worker.perform(pipeline_schedule.id, 10000) end end context 'when everything is ok' do - let(:project) { create(:project) } let(:create_pipeline_service) { instance_double(Ci::CreatePipelineService) } it 'calls the Service' do |