Rename Ci::Stage class to Ci::LegacyStage

This commit is contained in:
Grzegorz Bizon 2017-06-01 12:00:37 +02:00
parent c00d72b6f3
commit 78b2f65cb5
5 changed files with 9 additions and 7 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 }

View file

@ -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