Commit 7cd8b145 authored by Nick Thomas's avatar Nick Thomas

Merge request approvals before merge should be nil if unavailable

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