Commit 27122e9c authored by Douwe Maan's avatar Douwe Maan

Merge branch '35082-fix-mr-approvals-before-merge' into 'master'

Merge request approvals before merge should be nil if unavailable

Closes gitlab-ce#35082

See merge request !2426
parents 6f1b2005 7cd8b145
......@@ -23,7 +23,7 @@ module Approvable
end
def approvals_before_merge
return 0 unless project&.feature_available?(:merge_request_approvers)
return nil unless project&.feature_available?(:merge_request_approvers)
super
end
......
......@@ -137,9 +137,9 @@ describe MergeRequest, models: true do
describe '#approvals_before_merge' do
[
{ license: true, database: 5, expected: 5 },
{ license: true, database: 0, expected: 0 },
{ license: false, database: 5, expected: 0 },
{ license: false, database: 0, expected: 0 }
{ license: true, database: nil, expected: nil },
{ license: false, database: 5, expected: nil },
{ license: false, database: nil, expected: nil }
].each do |spec|
context spec.inspect do
let(:spec) { spec }
......
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