BigW Consortium Gitlab

Commit 78b2f65c by Grzegorz Bizon

Rename `Ci::Stage` class to `Ci::LegacyStage`

parent c00d72b6
module Ci module Ci
# Currently this is artificial object, constructed dynamically # Currently this is artificial object, constructed dynamically
# We should migrate this object to actual database record in the future # We should migrate this object to actual database record in the future
class Stage class LegacyStage
include StaticModel include StaticModel
attr_reader :pipeline, :name attr_reader :pipeline, :name
......
...@@ -161,7 +161,7 @@ module Ci ...@@ -161,7 +161,7 @@ module Ci
end end
def legacy_stage(name) def legacy_stage(name)
stage = Ci::Stage.new(self, name: name) stage = Ci::LegacyStage.new(self, name: name)
stage unless stage.statuses_count.zero? stage unless stage.statuses_count.zero?
end end
...@@ -180,7 +180,7 @@ module Ci ...@@ -180,7 +180,7 @@ module Ci
.pluck('sg.stage', status_sql, "(#{warnings_sql})") .pluck('sg.stage', status_sql, "(#{warnings_sql})")
stages_with_statuses.map do |stage| 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
end end
......
FactoryGirl.define do FactoryGirl.define do
factory :ci_stage, class: Ci::Stage do factory :ci_stage, class: Ci::LegacyStage do
transient do transient do
name 'test' name 'test'
status nil status nil
...@@ -8,7 +8,9 @@ FactoryGirl.define do ...@@ -8,7 +8,9 @@ FactoryGirl.define do
end end
initialize_with do 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 end
end end
require 'spec_helper' require 'spec_helper'
describe Ci::Stage, models: true do describe Ci::LegacyStage, :models do
let(:stage) { build(:ci_stage) } let(:stage) { build(:ci_stage) }
let(:pipeline) { stage.pipeline } let(:pipeline) { stage.pipeline }
let(:stage_name) { stage.name } let(:stage_name) { stage.name }
......
...@@ -292,7 +292,7 @@ describe Ci::Pipeline, models: true do ...@@ -292,7 +292,7 @@ describe Ci::Pipeline, models: true do
create(:commit_status, pipeline: pipeline, stage: 'test') create(:commit_status, pipeline: pipeline, stage: 'test')
end 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.name).to eq 'test' }
it { expect(subject.statuses).not_to be_empty } it { expect(subject.statuses).not_to be_empty }
end end
......
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