summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Shea <connor.james.shea@gmail.com>2016-07-14 08:58:05 -0600
committerConnor Shea <connor.james.shea@gmail.com>2016-07-19 12:31:24 -0600
commitb2a79554c339a583b6cc0d471b8224a24f11c96d (patch)
tree02147a633a1f15c860258f03eb87c4c391f1e90e
parentb306a52114bb155538dcee3b0eab815ac8d2655d (diff)
downloadgitlab-ce-b2a79554c339a583b6cc0d471b8224a24f11c96d.tar.gz
Address feedback.
-rw-r--r--app/controllers/projects/merge_requests_controller.rb2
-rw-r--r--app/models/ci/pipeline.rb6
-rw-r--r--spec/models/ci/pipeline_spec.rb24
3 files changed, 21 insertions, 11 deletions
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb
index 1d99aeeb672..7beeb7d97d0 100644
--- a/app/controllers/projects/merge_requests_controller.rb
+++ b/app/controllers/projects/merge_requests_controller.rb
@@ -286,7 +286,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
status = pipeline.status
coverage = pipeline.try(:coverage)
- status = "success_with_warnings" if pipeline.success? && pipeline.with_warnings?
+ status = "success_with_warnings" if pipeline.success? && pipeline.has_warnings?
status ||= "preparing"
else
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index e862978d7b4..90ed57e9aa0 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -146,10 +146,8 @@ module Ci
end
end
- def with_warnings?
- builds.latest.any? do |build|
- build.failed? && build.allow_failure
- end
+ def has_warnings?
+ builds.latest.ignored.any?
end
def config_processor
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index 20520b0a111..56cc10fa083 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -503,13 +503,13 @@ describe Ci::Pipeline, models: true do
end
end
- describe '#with_warnings?' do
- subject { pipeline.with_warnings? }
+ describe '#has_warnings?' do
+ subject { pipeline.has_warnings? }
context 'build which is allowed to fail fails' do
before do
- FactoryGirl.create :ci_build, :success, pipeline: pipeline, name: 'rspec'
- FactoryGirl.create :ci_build, :allowed_to_fail, :failed, pipeline: pipeline, name: 'rubocop'
+ create :ci_build, :success, pipeline: pipeline, name: 'rspec'
+ create :ci_build, :allowed_to_fail, :failed, pipeline: pipeline, name: 'rubocop'
end
it 'returns true' do
@@ -519,13 +519,25 @@ describe Ci::Pipeline, models: true do
context 'build which is allowed to fail succeeds' do
before do
- FactoryGirl.create :ci_build, :success, pipeline: pipeline, name: 'rspec'
- FactoryGirl.create :ci_build, :allowed_to_fail, :success, pipeline: pipeline, name: 'rubocop'
+ create :ci_build, :success, pipeline: pipeline, name: 'rspec'
+ create :ci_build, :allowed_to_fail, :success, pipeline: pipeline, name: 'rubocop'
end
it 'returns false' do
is_expected.to be_falsey
end
end
+
+ context 'build is retried and succeeds' do
+ before do
+ create :ci_build, :success, pipeline: pipeline, name: 'rubocop'
+ create :ci_build, :failed, pipeline: pipeline, name: 'rspec'
+ create :ci_build, :success, pipeline: pipeline, name: 'rspec'
+ end
+
+ it 'returns false' do
+ is_expected.to be_falsey
+ end
+ end
end
end