diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-02-09 14:14:25 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-02-13 15:11:21 +0100 |
commit | 4e3fc2121731b42318af13968638e8cfc6651a61 (patch) | |
tree | be263110b774f919d9bbe6f6c25d320a2949fbc9 | |
parent | ffcf3c68586b5e4a977a3c92cd1b3f8b1871c322 (diff) | |
download | gitlab-ce-4e3fc2121731b42318af13968638e8cfc6651a61.tar.gz |
Extend specs for canceling a running pipeline
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 3be489c7c5c..653f340ae72 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -728,7 +728,7 @@ describe Ci::Pipeline, models: true do describe '#cancel_running' do let(:latest_status) { pipeline.statuses.pluck(:status) } - context 'when there is a running external job and created build' do + context 'when there is a running external job and a regular job' do before do create(:ci_build, :running, pipeline: pipeline) create(:generic_commit_status, :running, pipeline: pipeline) @@ -741,7 +741,7 @@ describe Ci::Pipeline, models: true do end end - context 'when builds are in different stages' do + context 'when jobs are in different stages' do before do create(:ci_build, :running, stage_idx: 0, pipeline: pipeline) create(:ci_build, :running, stage_idx: 1, pipeline: pipeline) @@ -753,6 +753,19 @@ describe Ci::Pipeline, models: true do expect(latest_status).to contain_exactly('canceled', 'canceled') end end + + context 'when there are created builds present in the pipeline' do + before do + create(:ci_build, :running, stage_idx: 0, pipeline: pipeline) + create(:ci_build, :created, stage_idx: 1, pipeline: pipeline) + + pipeline.cancel_running + end + + it 'skips created builds' do + expect(latest_status).to eq ['canceled', 'skipped'] + end + end end describe '#retry_failed' do |