提交 8b30dd98 编写于 作者: G Grzegorz Bizon

Extract abstract success with warnings CI/CD status

上级 4404ea86
......@@ -4,7 +4,7 @@ module Gitlab
module Pipeline
class Factory < Status::Factory
def self.extended_statuses
[Pipeline::SuccessWithWarnings]
[Pipeline::SuccessWarning]
end
def self.common_helpers
......
......@@ -2,25 +2,7 @@ module Gitlab
module Ci
module Status
module Pipeline
class SuccessWithWarnings < SimpleDelegator
include Status::Extended
def text
'passed'
end
def label
'passed with warnings'
end
def icon
'icon_status_warning'
end
def group
'success_with_warnings'
end
class SuccessWarning < Status::SuccessWarning
def self.matches?(pipeline, user)
pipeline.success? && pipeline.has_warnings?
end
......
module Gitlab
module Ci
module Status
##
# Abstract extended status used when pipeline/stage/build passed
# conditionally.
#
# This means that failed jobs that are allowed to fail were present.
#
class SuccessWarning < SimpleDelegator
include Status::Extended
def text
'passed'
end
def label
'passed with warnings'
end
def icon
'icon_status_warning'
end
def group
'success_with_warnings'
end
def self.matches?(subject, user)
raise NotImplementedError
end
end
end
end
end
......@@ -49,7 +49,7 @@ describe Gitlab::Ci::Status::Pipeline::Factory do
it 'fabricates extended "success with warnings" status' do
expect(status)
.to be_a Gitlab::Ci::Status::Pipeline::SuccessWithWarnings
.to be_a Gitlab::Ci::Status::Pipeline::SuccessWarning
end
it 'extends core status with common pipeline methods' do
......
require 'spec_helper'
describe Gitlab::Ci::Status::Pipeline::SuccessWithWarnings do
describe Gitlab::Ci::Status::Pipeline::SuccessWarning do
subject do
described_class.new(double('status'))
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册