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 Ci
module Status module Status
module Core class Canceled < Status::Core
class Canceled < Core::Base
def text def text
'canceled' 'canceled'
end end
......
module Gitlab::Ci module Gitlab
module Ci
module Status module Status
module Core
# 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 Ci
module Status module Status
module Core class Created < Status::Core
class Created < Core::Base
def text def text
'created' 'created'
end end
......
module Gitlab::Ci module Gitlab
module Ci
module Status module Status
module Extended module Extended
module Base
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 Ci
module Status module Status
module Core class Failed < Status::Core
class Failed < Core::Base
def text def text
'failed' 'failed'
end end
......
module Gitlab::Ci module Gitlab
module Ci
module Status module Status
module Core class Pending < Status::Core
class Pending < Core::Base
def text def text
'pending' 'pending'
end end
......
module Gitlab::Ci module Gitlab
module Ci
module Status module Status
module Extended
module Pipeline module Pipeline
module Common module Common
def has_details? def has_details?
......
module Gitlab::Ci module Gitlab
module Ci
module Status module Status
module Extended
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 Ci
module Status module Status
module Core class Running < Status::Core
class Running < Core::Base
def text def text
'running' 'running'
end end
......
module Gitlab::Ci module Gitlab
module Ci
module Status module Status
module Core class Skipped < Status::Core
class Skipped < Core::Base
def text def text
'skipped' 'skipped'
end end
......
module Gitlab::Ci module Gitlab
module Ci
module Status module Status
module Core class Success < Status::Core
class Success < Core::Base
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