Commit b86d8afe authored by Grzegorz Bizon's avatar Grzegorz Bizon

Fold core/extended status modules to reduce nesting

parent d55ff247
module Gitlab::Ci module Gitlab
module Status module Ci
module Core module Status
class Canceled < Core::Base class Canceled < Status::Core
def text def text
'canceled' 'canceled'
end end
......
module Gitlab::Ci module Gitlab
module Status module Ci
module Core module Status
# Base abstract class fore core status # Base abstract class fore core status
# #
class Base class Core
include Gitlab::Routing.url_helpers include Gitlab::Routing.url_helpers
def initialize(subject) def initialize(subject)
......
module Gitlab::Ci module Gitlab
module Status module Ci
module Core module Status
class Created < Core::Base class Created < Status::Core
def text def text
'created' 'created'
end end
......
module Gitlab::Ci module Gitlab
module Status module Ci
module Extended module Status
module Base module Extended
def matches?(_subject) def matches?(_subject)
raise NotImplementedError raise NotImplementedError
end end
......
module Gitlab::Ci
module Status
class Factory
end
end
end
module Gitlab::Ci module Gitlab
module Status module Ci
module Core module Status
class Failed < Core::Base class Failed < Status::Core
def text def text
'failed' 'failed'
end end
......
module Gitlab::Ci module Gitlab
module Status module Ci
module Core module Status
class Pending < Core::Base class Pending < Status::Core
def text def text
'pending' 'pending'
end end
......
module Gitlab::Ci module Gitlab
module Status module Ci
module Extended module Status
module Pipeline module Pipeline
module Common module Common
def has_details? def has_details?
......
module Gitlab::Ci module Gitlab
module Status module Ci
module Extended module Status
module Pipeline module Pipeline
class SuccessWithWarnings < SimpleDelegator class SuccessWithWarnings < SimpleDelegator
extend Status::Extended::Base extend Status::Extended
def text def text
'passed' 'passed'
......
module Gitlab::Ci module Gitlab
module Status module Ci
module Core module Status
class Running < Core::Base class Running < Status::Core
def text def text
'running' 'running'
end end
......
module Gitlab::Ci module Gitlab
module Status module Ci
module Core module Status
class Skipped < Core::Base class Skipped < Status::Core
def text def text
'skipped' 'skipped'
end end
......
module Gitlab::Ci module Gitlab
module Status module Ci
module Core module Status
class Success < Core::Base class Success < Status::Core
def text def text
'passed' 'passed'
end end
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Ci::Status::Core::Canceled do describe Gitlab::Ci::Status::Canceled do
subject { described_class.new(double('subject')) } subject { described_class.new(double('subject')) }
describe '#text' do describe '#text' do
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Ci::Status::Core::Created do describe Gitlab::Ci::Status::Created do
subject { described_class.new(double('subject')) } subject { described_class.new(double('subject')) }
describe '#text' do describe '#text' do
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Ci::Status::Extended::Base do describe Gitlab::Ci::Status::Extended do
subject do subject do
Class.new.extend(described_class) Class.new.extend(described_class)
end end
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Ci::Status::Core::Failed do describe Gitlab::Ci::Status::Failed do
subject { described_class.new(double('subject')) } subject { described_class.new(double('subject')) }
describe '#text' do describe '#text' do
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Ci::Status::Core::Pending do describe Gitlab::Ci::Status::Pending do
subject { described_class.new(double('subject')) } subject { described_class.new(double('subject')) }
describe '#text' do describe '#text' do
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Ci::Status::Extended::Pipeline::Common do describe Gitlab::Ci::Status::Pipeline::Common do
let(:pipeline) { create(:ci_pipeline) } let(:pipeline) { create(:ci_pipeline) }
subject do subject do
Gitlab::Ci::Status::Core::Success Class.new(Gitlab::Ci::Status::Core)
.new(pipeline).extend(described_class) .new(pipeline).extend(described_class)
end end
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Ci::Status::Extended::Pipeline::SuccessWithWarnings do describe Gitlab::Ci::Status::Pipeline::SuccessWithWarnings do
subject do subject do
described_class.new(double('status')) described_class.new(double('status'))
end end
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Ci::Status::Core::Running do describe Gitlab::Ci::Status::Running do
subject { described_class.new(double('subject')) } subject { described_class.new(double('subject')) }
describe '#text' do describe '#text' do
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Ci::Status::Core::Skipped do describe Gitlab::Ci::Status::Skipped do
subject { described_class.new(double('subject')) } subject { described_class.new(double('subject')) }
describe '#text' do describe '#text' do
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Ci::Status::Core::Success do describe Gitlab::Ci::Status::Success do
subject { described_class.new(double('subject')) } subject { described_class.new(double('subject')) }
describe '#text' do describe '#text' do
......
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