diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-05-25 12:43:27 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-05-25 12:43:27 +0200 |
commit | 887818d3cb58406555bc038ed36b75b7a4ce2631 (patch) | |
tree | f00113eb6148c287dbba868348efc1a4b03394e9 /spec/models/ci/stage_spec.rb | |
parent | 0e1b3dc41b61c8d9f6a1432c4f823253cbeb5c4d (diff) | |
download | gitlab-ce-887818d3cb58406555bc038ed36b75b7a4ce2631.tar.gz |
Do not update stage status when it is just created
Diffstat (limited to 'spec/models/ci/stage_spec.rb')
-rw-r--r-- | spec/models/ci/stage_spec.rb | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/spec/models/ci/stage_spec.rb b/spec/models/ci/stage_spec.rb index a00db1d2bfc..d82bf20b032 100644 --- a/spec/models/ci/stage_spec.rb +++ b/spec/models/ci/stage_spec.rb @@ -65,7 +65,31 @@ describe Ci::Stage, :models do end end - context 'when stage is skipped' do + context 'when stage has only created builds' do + let(:stage) { create(:ci_stage_entity, status: :created) } + + before do + create(:ci_build, :created, stage_id: stage.id) + end + + it 'updates status to skipped' do + expect(stage.reload.status).to eq 'created' + end + end + + context 'when stage is skipped because of skipped builds' do + before do + create(:ci_build, :skipped, stage_id: stage.id) + end + + it 'updates status to skipped' do + expect { stage.update_status } + .to change { stage.reload.status } + .to 'skipped' + end + end + + context 'when stage is skipped because is empty' do it 'updates status to skipped' do expect { stage.update_status } .to change { stage.reload.status } |