summaryrefslogtreecommitdiff
path: root/spec/models/ci/stage_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/ci/stage_spec.rb')
-rw-r--r--spec/models/ci/stage_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/ci/stage_spec.rb b/spec/models/ci/stage_spec.rb
index 22a4556c10c..5076f7faeac 100644
--- a/spec/models/ci/stage_spec.rb
+++ b/spec/models/ci/stage_spec.rb
@@ -89,6 +89,18 @@ describe Ci::Stage, :models do
end
end
+ context 'when stage is scheduled because of scheduled builds' do
+ before do
+ create(:ci_build, :scheduled, stage_id: stage.id)
+ end
+
+ it 'updates status to scheduled' do
+ expect { stage.update_status }
+ .to change { stage.reload.status }
+ .to 'scheduled'
+ end
+ end
+
context 'when stage is skipped because is empty' do
it 'updates status to skipped' do
expect { stage.update_status }
@@ -188,6 +200,18 @@ describe Ci::Stage, :models do
end
end
+ describe '#delay' do
+ subject { stage.delay }
+
+ let(:stage) { create(:ci_stage_entity, status: :created) }
+
+ it 'updates stage status' do
+ subject
+
+ expect(stage).to be_scheduled
+ end
+ end
+
describe '#position' do
context 'when stage has been imported and does not have position index set' do
before do