diff options
author | Rémy Coutable <remy@rymai.me> | 2016-06-16 11:48:36 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-06-16 11:48:36 +0000 |
commit | 46bba4e75805544945fb6de5c050a7d2959e2780 (patch) | |
tree | 09749e5673bc9d938bdb192f3af73974fd65feb7 /spec/models | |
parent | c369cc8bf42a680b2b0fc9721a9a7926dc5426f6 (diff) | |
parent | d8670e114af1e21c48878afe8af16cc5628861fa (diff) | |
download | gitlab-ce-46bba4e75805544945fb6de5c050a7d2959e2780.tar.gz |
Merge branch 'fix/status-of-pipeline-without-builds' into 'master'
Improve pipeline status in case that pipeline has no jobs
## What does this MR do?
This MR resolves problem with pipeline status when there are no build in pipeline.
This can happen when builds were skipped - for example - by using `only`/`except` keyword in `.gitlab-ci.yml`.
## What are the relevant issue numbers?
Closes #17977
See merge request !4403
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 0d769ed7324..34507cf5083 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -258,6 +258,19 @@ describe Ci::Pipeline, models: true do end end end + + context 'when no builds created' do + let(:pipeline) { build(:ci_pipeline) } + + before do + stub_ci_pipeline_yaml_file(YAML.dump(before_script: ['ls'])) + end + + it 'returns false' do + expect(pipeline.create_builds(nil)).to be_falsey + expect(pipeline).not_to be_persisted + end + end end describe "#finished_at" do |