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 ...@@ -74,8 +74,7 @@ module Ci
when 'failed' then drop when 'failed' then drop
when 'canceled' then cancel when 'canceled' then cancel
when 'manual' then block when 'manual' then block
when 'skipped' then skip when 'skipped', nil then skip
else skip
end end
end end
end end
......
...@@ -65,7 +65,31 @@ describe Ci::Stage, :models do ...@@ -65,7 +65,31 @@ describe Ci::Stage, :models do
end end
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 it 'updates status to skipped' do
expect { stage.update_status } expect { stage.update_status }
.to change { stage.reload.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