summaryrefslogtreecommitdiff
path: root/spec/models/ci/stage_spec.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-04-18 14:56:08 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-04-24 11:07:37 +0200
commit6a2f8a9afb176600133939f61ccad587c9da7879 (patch)
tree0eb7b1c9d27c6f44f7941f901852cf544c46364a /spec/models/ci/stage_spec.rb
parent10df70146ea2682b72098ff890366420a15374a7 (diff)
downloadgitlab-ce-6a2f8a9afb176600133939f61ccad587c9da7879.tar.gz
Ensure that an imported pipeline stage can be updated
Diffstat (limited to 'spec/models/ci/stage_spec.rb')
-rw-r--r--spec/models/ci/stage_spec.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/spec/models/ci/stage_spec.rb b/spec/models/ci/stage_spec.rb
index 586d073eb5e..1e08b59c380 100644
--- a/spec/models/ci/stage_spec.rb
+++ b/spec/models/ci/stage_spec.rb
@@ -51,7 +51,7 @@ describe Ci::Stage, :models do
end
end
- describe 'update_status' do
+ describe '#update_status' do
context 'when stage objects needs to be updated' do
before do
create(:ci_build, :success, stage_id: stage.id)
@@ -87,4 +87,21 @@ describe Ci::Stage, :models do
end
end
end
+
+ describe '#index' do
+ context 'when stage has been imported and does not have index set' do
+ before do
+ create(:ci_build, :running, stage_id: stage.id, stage_idx: 10)
+ stage.update_column(:index, nil)
+ end
+
+ it 'recalculates index before updating status' do
+ expect(stage.reload.index).to be_nil
+
+ stage.update_status
+
+ expect(stage.reload.index).to eq 10
+ end
+ end
+ end
end