summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-01-09 11:46:15 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-01-11 13:53:17 +0100
commit8b30dd9834fd4026b846b016868701d8e95ec048 (patch)
treed192b2dc27bbbc160f0c2f2986b6a5fe7bee4777
parent4404ea8662508c60f96e6730d9a45feb68498c28 (diff)
downloadgitlab-ce-8b30dd9834fd4026b846b016868701d8e95ec048.tar.gz
Extract abstract success with warnings CI/CD status
-rw-r--r--lib/gitlab/ci/status/pipeline/factory.rb2
-rw-r--r--lib/gitlab/ci/status/pipeline/success_warning.rb13
-rw-r--r--lib/gitlab/ci/status/pipeline/success_with_warnings.rb31
-rw-r--r--lib/gitlab/ci/status/success_warning.rb35
-rw-r--r--spec/lib/gitlab/ci/status/pipeline/factory_spec.rb2
-rw-r--r--spec/lib/gitlab/ci/status/pipeline/success_warning_spec.rb (renamed from spec/lib/gitlab/ci/status/pipeline/success_with_warnings_spec.rb)2
6 files changed, 51 insertions, 34 deletions
diff --git a/lib/gitlab/ci/status/pipeline/factory.rb b/lib/gitlab/ci/status/pipeline/factory.rb
index 16dcb326be9..31e56a485b7 100644
--- a/lib/gitlab/ci/status/pipeline/factory.rb
+++ b/lib/gitlab/ci/status/pipeline/factory.rb
@@ -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
diff --git a/lib/gitlab/ci/status/pipeline/success_warning.rb b/lib/gitlab/ci/status/pipeline/success_warning.rb
new file mode 100644
index 00000000000..8387682e744
--- /dev/null
+++ b/lib/gitlab/ci/status/pipeline/success_warning.rb
@@ -0,0 +1,13 @@
+module Gitlab
+ module Ci
+ module Status
+ module Pipeline
+ class SuccessWarning < Status::SuccessWarning
+ def self.matches?(pipeline, user)
+ pipeline.success? && pipeline.has_warnings?
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/ci/status/pipeline/success_with_warnings.rb b/lib/gitlab/ci/status/pipeline/success_with_warnings.rb
deleted file mode 100644
index 24bf8b869e0..00000000000
--- a/lib/gitlab/ci/status/pipeline/success_with_warnings.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-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
-
- def self.matches?(pipeline, user)
- pipeline.success? && pipeline.has_warnings?
- end
- end
- end
- end
- end
-end
diff --git a/lib/gitlab/ci/status/success_warning.rb b/lib/gitlab/ci/status/success_warning.rb
new file mode 100644
index 00000000000..2affcc08f50
--- /dev/null
+++ b/lib/gitlab/ci/status/success_warning.rb
@@ -0,0 +1,35 @@
+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
diff --git a/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb b/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb
index d4a2dc7fcc1..672f5733e98 100644
--- a/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb
+++ b/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb
@@ -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
diff --git a/spec/lib/gitlab/ci/status/pipeline/success_with_warnings_spec.rb b/spec/lib/gitlab/ci/status/pipeline/success_warning_spec.rb
index 979160eb9c4..ee3f6174b73 100644
--- a/spec/lib/gitlab/ci/status/pipeline/success_with_warnings_spec.rb
+++ b/spec/lib/gitlab/ci/status/pipeline/success_warning_spec.rb
@@ -1,6 +1,6 @@
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