Commit b2a79554 authored by Connor Shea's avatar Connor Shea

Address feedback.

parent b306a521
...@@ -286,7 +286,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -286,7 +286,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
status = pipeline.status status = pipeline.status
coverage = pipeline.try(:coverage) 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" status ||= "preparing"
else else
......
...@@ -146,10 +146,8 @@ module Ci ...@@ -146,10 +146,8 @@ module Ci
end end
end end
def with_warnings? def has_warnings?
builds.latest.any? do |build| builds.latest.ignored.any?
build.failed? && build.allow_failure
end
end end
def config_processor def config_processor
......
...@@ -503,13 +503,13 @@ describe Ci::Pipeline, models: true do ...@@ -503,13 +503,13 @@ describe Ci::Pipeline, models: true do
end end
end end
describe '#with_warnings?' do describe '#has_warnings?' do
subject { pipeline.with_warnings? } subject { pipeline.has_warnings? }
context 'build which is allowed to fail fails' do context 'build which is allowed to fail fails' do
before do before do
FactoryGirl.create :ci_build, :success, pipeline: pipeline, name: 'rspec' create :ci_build, :success, pipeline: pipeline, name: 'rspec'
FactoryGirl.create :ci_build, :allowed_to_fail, :failed, pipeline: pipeline, name: 'rubocop' create :ci_build, :allowed_to_fail, :failed, pipeline: pipeline, name: 'rubocop'
end end
it 'returns true' do it 'returns true' do
...@@ -519,8 +519,20 @@ describe Ci::Pipeline, models: true do ...@@ -519,8 +519,20 @@ describe Ci::Pipeline, models: true do
context 'build which is allowed to fail succeeds' do context 'build which is allowed to fail succeeds' do
before do before do
FactoryGirl.create :ci_build, :success, pipeline: pipeline, name: 'rspec' create :ci_build, :success, pipeline: pipeline, name: 'rspec'
FactoryGirl.create :ci_build, :allowed_to_fail, :success, pipeline: pipeline, name: 'rubocop' 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 end
it 'returns false' do it 'returns false' 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