Commit 887818d3 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Do not update stage status when it is just created

parent 0e1b3dc4
......@@ -74,8 +74,7 @@ module Ci
when 'failed' then drop
when 'canceled' then cancel
when 'manual' then block
when 'skipped' then skip
else skip
when 'skipped', nil then skip
end
end
end
......
......@@ -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 }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment