diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-08-16 13:30:49 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-08-16 13:30:49 +0200 |
commit | 1066d8ba77ba242851c906aa523bd7548dad1d15 (patch) | |
tree | e552198337dff4ef5b6b02d2ee5360b2fe305517 | |
parent | 32d0983a4ea3ce61b78e4d11d61892989ac4cb35 (diff) | |
download | gitlab-ce-1066d8ba77ba242851c906aa523bd7548dad1d15.tar.gz |
Use usual method to retrieve CI/CD stage statuses
-rw-r--r-- | app/models/ci/stage.rb | 4 | ||||
-rw-r--r-- | spec/factories/ci/stages.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/import_export/all_models.yml | 2 | ||||
-rw-r--r-- | spec/models/ci/stage_spec.rb | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/app/models/ci/stage.rb b/app/models/ci/stage.rb index 7819bc3cd2c..4ee972fa68d 100644 --- a/app/models/ci/stage.rb +++ b/app/models/ci/stage.rb @@ -10,7 +10,7 @@ module Ci belongs_to :project belongs_to :pipeline - has_many :commit_statuses, foreign_key: :stage_id + has_many :statuses, class_name: 'CommitStatus', foreign_key: :stage_id has_many :builds, foreign_key: :stage_id validates :project, presence: true, unless: :importing? @@ -50,7 +50,7 @@ module Ci def update_status retry_optimistic_lock(self) do - case commit_statuses.latest.status + case statuses.latest.status when 'pending' then enqueue when 'running' then run when 'success' then succeed diff --git a/spec/factories/ci/stages.rb b/spec/factories/ci/stages.rb index bace932cf99..b2ded945738 100644 --- a/spec/factories/ci/stages.rb +++ b/spec/factories/ci/stages.rb @@ -17,7 +17,7 @@ FactoryGirl.define do end factory :ci_stage_entity, class: Ci::Stage do - project factory: :empty_project + project factory: :project pipeline factory: :ci_empty_pipeline name 'test' diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml index f323777b13a..8da02b0cf00 100644 --- a/spec/lib/gitlab/import_export/all_models.yml +++ b/spec/lib/gitlab/import_export/all_models.yml @@ -119,7 +119,7 @@ pipeline_variables: stages: - project - pipeline -- commit_statuses +- statuses - builds statuses: - project diff --git a/spec/models/ci/stage_spec.rb b/spec/models/ci/stage_spec.rb index d5c66598451..74c9d6145e2 100644 --- a/spec/models/ci/stage_spec.rb +++ b/spec/models/ci/stage_spec.rb @@ -9,9 +9,9 @@ describe Ci::Stage, :models do create(:commit_status, stage_id: stage.id) end - describe '#commit_statuses' do + describe '#statuses' do it 'returns all commit statuses' do - expect(stage.commit_statuses.count).to be 2 + expect(stage.statuses.count).to be 2 end end |