Commit 40172d28 authored by Gabriel Mazetto's avatar Gabriel Mazetto

fix fast-forward merge requests git hooks validations

parent 5a688e4f
......@@ -9,7 +9,7 @@ module MergeRequests
attr_reader :merge_request
def execute(merge_request)
if @project.merge_requests_ff_only_enabled && !self.is_a?(FfMergeService)
if project.merge_requests_ff_only_enabled && !self.is_a?(FfMergeService)
FfMergeService.new(project, current_user, params).execute(merge_request)
return
end
......@@ -29,6 +29,8 @@ module MergeRequests
end
def hooks_validation_pass?(merge_request)
return true if project.merge_requests_ff_only_enabled
git_hook = merge_request.project.git_hook
return true unless git_hook
......
......@@ -96,5 +96,13 @@ describe MergeRequests::MergeService, services: true do
expect(merge_request.merge_error).not_to be_empty
end
end
context 'fast forward merge request' do
it 'returns true when fast forward is enabled' do
allow(project).to receive(:merge_requests_ff_only_enabled) { true }
expect(service.hooks_validation_pass?(merge_request)).to be_truthy
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