Commit c5570094 authored by Erick Bajao's avatar Erick Bajao

Don't require approval for coverage when base pipeline is missing

parent d8d6a39c
......@@ -59,13 +59,8 @@ module Ci
pipeline.merge_requests_as_head_pipeline.reject do |merge_request|
base_pipeline = merge_request.base_pipeline
if base_pipeline.present?
pipeline.coverage < base_pipeline.coverage
else
# base pipeline is missing so we can't make an assumption
# if the coverage is better or not. We default to require approval.
true
end
# if base pipeline is missing we just default to not require approval.
pipeline.coverage < base_pipeline.coverage if base_pipeline.present?
end
end
......
......@@ -285,9 +285,9 @@ RSpec.describe Ci::SyncReportsToApprovalRulesService, '#execute' do
allow(pipeline).to receive(:complete?).and_return(true)
end
it "won't lower approvals_required count" do
it "lowers approvals_required count" do
expect { sync_rules }
.not_to change { report_approver_rule.reload.approvals_required }
.to change { report_approver_rule.reload.approvals_required }.from(2).to(0)
end
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