BigW Consortium Gitlab

Commit 78b2f65c by Grzegorz Bizon

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

parent c00d72b6
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
......
......@@ -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
......
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
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 }
......
......@@ -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
......
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