Commit f2f8de61 authored by Micaël Bergeron's avatar Micaël Bergeron

this spec will correctly fail when reverting the fix

parent a304a399
...@@ -36,7 +36,7 @@ module EE ...@@ -36,7 +36,7 @@ module EE
def clamp_approvals_before_merge(mr_params) def clamp_approvals_before_merge(mr_params)
return mr_params unless mr_params[:approvals_before_merge] return mr_params unless mr_params[:approvals_before_merge]
# target the MR target project in priority, else it depends wether the project # Target the MR target project in priority, else it depends whether the project
# is forked. # is forked.
target_project = if @merge_request target_project = if @merge_request
@merge_request.target_project @merge_request.target_project
......
...@@ -291,19 +291,25 @@ describe Projects::MergeRequestsController do ...@@ -291,19 +291,25 @@ describe Projects::MergeRequestsController do
let(:upstream) { create(:project, :repository) } let(:upstream) { create(:project, :repository) }
let(:project) { create(:project, :repository, forked_from_project: upstream) } let(:project) { create(:project, :repository, forked_from_project: upstream) }
before do
project.add_developer(user)
upstream.add_developer(user)
upstream.update_attributes(approvals_before_merge: 2)
end
context 'when the MR target upstream' do context 'when the MR target upstream' do
let(:merge_request) { create(:merge_request, title: 'This is targeting upstream', source_project: project, target_project: upstream) } let(:merge_request) { create(:merge_request, title: 'This is targeting upstream', source_project: project, target_project: upstream) }
before do
upstream.add_developer(user)
upstream.update_attributes(approvals_before_merge: 2)
end
it_behaves_like 'approvals_before_merge param' it_behaves_like 'approvals_before_merge param'
end end
context 'when the MR target the fork' do context 'when the MR target the fork' do
let(:merge_request) { create(:merge_request, title: 'This is targeting the fork', source_project: project, target_project: project) }
before do
project.add_developer(user)
project.update_attributes(approvals_before_merge: 0)
end
it_behaves_like 'approvals_before_merge param' it_behaves_like 'approvals_before_merge param'
end 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