summaryrefslogtreecommitdiff
path: root/spec/workers/pipeline_schedule_worker_spec.rb
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-12-06 09:39:13 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2017-12-06 09:39:13 +0000
commit3b9102b200d25bf1164b15675db65db567d26b7b (patch)
tree445aaef220b399a3d88204fec130cbd270334990 /spec/workers/pipeline_schedule_worker_spec.rb
parentcc0c61155561e5baa1b28319ceb6633858a7d9f8 (diff)
parent1bc1c2d0b2cc5c4c1de5ebdf4229edf6d13d6636 (diff)
downloadgitlab-ce-3b9102b200d25bf1164b15675db65db567d26b7b.tar.gz
Merge branch 'multiple-clusters-single-list' into 'list-multiple-clusters'list-multiple-clusters
Use single list for multiple clusters See merge request gitlab-org/gitlab-ce!15669
Diffstat (limited to 'spec/workers/pipeline_schedule_worker_spec.rb')
-rw-r--r--spec/workers/pipeline_schedule_worker_spec.rb31
1 files changed, 19 insertions, 12 deletions
diff --git a/spec/workers/pipeline_schedule_worker_spec.rb b/spec/workers/pipeline_schedule_worker_spec.rb
index 75197039f5a..e7a4ac0f3d6 100644
--- a/spec/workers/pipeline_schedule_worker_spec.rb
+++ b/spec/workers/pipeline_schedule_worker_spec.rb
@@ -22,25 +22,32 @@ describe PipelineScheduleWorker do
end
context 'when there is a scheduled pipeline within next_run_at' do
- it 'creates a new pipeline' do
- expect { subject }.to change { project.pipelines.count }.by(1)
- expect(Ci::Pipeline.last).to be_schedule
+ shared_examples 'successful scheduling' do
+ it 'creates a new pipeline' do
+ expect { subject }.to change { project.pipelines.count }.by(1)
+ expect(Ci::Pipeline.last).to be_schedule
+
+ pipeline_schedule.reload
+ expect(pipeline_schedule.next_run_at).to be > Time.now
+ expect(pipeline_schedule).to eq(project.pipelines.last.pipeline_schedule)
+ expect(pipeline_schedule).to be_active
+ end
end
- it 'updates the next_run_at field' do
- subject
+ it_behaves_like 'successful scheduling'
- expect(pipeline_schedule.reload.next_run_at).to be > Time.now
- end
-
- it 'sets the schedule on the pipeline' do
- subject
+ context 'when the latest commit contains [ci skip]' do
+ before do
+ allow_any_instance_of(Ci::Pipeline)
+ .to receive(:git_commit_message)
+ .and_return('some commit [ci skip]')
+ end
- expect(project.pipelines.last.pipeline_schedule).to eq(pipeline_schedule)
+ it_behaves_like 'successful scheduling'
end
end
- context 'inactive schedule' do
+ context 'when the schedule is deactivated' do
before do
pipeline_schedule.deactivate!
end