Commit 8b30dd98 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Extract abstract success with warnings CI/CD status

parent 4404ea86
...@@ -4,7 +4,7 @@ module Gitlab ...@@ -4,7 +4,7 @@ module Gitlab
module Pipeline module Pipeline
class Factory < Status::Factory class Factory < Status::Factory
def self.extended_statuses def self.extended_statuses
[Pipeline::SuccessWithWarnings] [Pipeline::SuccessWarning]
end end
def self.common_helpers def self.common_helpers
......
...@@ -2,25 +2,7 @@ module Gitlab ...@@ -2,25 +2,7 @@ module Gitlab
module Ci module Ci
module Status module Status
module Pipeline module Pipeline
class SuccessWithWarnings < SimpleDelegator class SuccessWarning < Status::SuccessWarning
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?(pipeline, user) def self.matches?(pipeline, user)
pipeline.success? && pipeline.has_warnings? pipeline.success? && pipeline.has_warnings?
end 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 ...@@ -49,7 +49,7 @@ describe Gitlab::Ci::Status::Pipeline::Factory do
it 'fabricates extended "success with warnings" status' do it 'fabricates extended "success with warnings" status' do
expect(status) expect(status)
.to be_a Gitlab::Ci::Status::Pipeline::SuccessWithWarnings .to be_a Gitlab::Ci::Status::Pipeline::SuccessWarning
end end
it 'extends core status with common pipeline methods' do it 'extends core status with common pipeline methods' do
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Ci::Status::Pipeline::SuccessWithWarnings do describe Gitlab::Ci::Status::Pipeline::SuccessWarning do
subject do subject do
described_class.new(double('status')) described_class.new(double('status'))
end 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