diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-06-01 12:00:37 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-06-01 12:00:37 +0200 |
commit | 78b2f65cb5320a6a28c1e26bb6ee792a54e1b674 (patch) | |
tree | a737219462c734afae30236fbf30f4cdd05de4fa | |
parent | c00d72b6f33d50b1c5cd6948d54b3addf11f9104 (diff) | |
download | gitlab-ce-78b2f65cb5320a6a28c1e26bb6ee792a54e1b674.tar.gz |
Rename `Ci::Stage` class to `Ci::LegacyStage`
-rw-r--r-- | app/models/ci/legacy_stage.rb (renamed from app/models/ci/stage.rb) | 2 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 4 | ||||
-rw-r--r-- | spec/factories/ci/stages.rb | 6 | ||||
-rw-r--r-- | spec/models/ci/legacy_stage_spec.rb (renamed from spec/models/ci/stage_spec.rb) | 2 | ||||
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 2 |
5 files changed, 9 insertions, 7 deletions
diff --git a/app/models/ci/stage.rb b/app/models/ci/legacy_stage.rb index 9bda3186c30..9b536af672b 100644 --- a/app/models/ci/stage.rb +++ b/app/models/ci/legacy_stage.rb @@ -1,7 +1,7 @@ module Ci # Currently this is artificial object, constructed dynamically # We should migrate this object to actual database record in the future - class Stage + class LegacyStage include StaticModel attr_reader :pipeline, :name diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 8e687fd5c08..e64e16657fe 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -161,7 +161,7 @@ module Ci end def legacy_stage(name) - stage = Ci::Stage.new(self, name: name) + stage = Ci::LegacyStage.new(self, name: name) stage unless stage.statuses_count.zero? end @@ -180,7 +180,7 @@ module Ci .pluck('sg.stage', status_sql, "(#{warnings_sql})") stages_with_statuses.map do |stage| - Ci::Stage.new(self, Hash[%i[name status warnings].zip(stage)]) + Ci::LegacyStage.new(self, Hash[%i[name status warnings].zip(stage)]) end end diff --git a/spec/factories/ci/stages.rb b/spec/factories/ci/stages.rb index 7f557b25ccb..884661e1030 100644 --- a/spec/factories/ci/stages.rb +++ b/spec/factories/ci/stages.rb @@ -1,5 +1,5 @@ FactoryGirl.define do - factory :ci_stage, class: Ci::Stage do + factory :ci_stage, class: Ci::LegacyStage do transient do name 'test' status nil @@ -8,7 +8,9 @@ FactoryGirl.define do end initialize_with do - Ci::Stage.new(pipeline, name: name, status: status, warnings: warnings) + Ci::LegacyStage.new(pipeline, name: name, + status: status, + warnings: warnings) end end end diff --git a/spec/models/ci/stage_spec.rb b/spec/models/ci/legacy_stage_spec.rb index 8f6ab908987..48116c7e701 100644 --- a/spec/models/ci/stage_spec.rb +++ b/spec/models/ci/legacy_stage_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Ci::Stage, models: true do +describe Ci::LegacyStage, :models do let(:stage) { build(:ci_stage) } let(:pipeline) { stage.pipeline } let(:stage_name) { stage.name } diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 46dfa90218d..17e10a5322e 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -292,7 +292,7 @@ describe Ci::Pipeline, models: true do create(:commit_status, pipeline: pipeline, stage: 'test') end - it { expect(subject).to be_a Ci::Stage } + it { expect(subject).to be_a Ci::LegacyStage } it { expect(subject.name).to eq 'test' } it { expect(subject.statuses).not_to be_empty } end |