Commit 4e16edbe authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Add feature-flag support

Returns error in MergeToRefService when
merge_to_tmp_merge_ref_path ff is disabled.
parent 105212ce
...@@ -34,7 +34,9 @@ module MergeRequests ...@@ -34,7 +34,9 @@ module MergeRequests
def error_check! def error_check!
error = error =
if !merge_method_supported? if Feature.disabled?(:merge_to_tmp_merge_ref_path, project)
'Feature is not enabled'
elsif !merge_method_supported?
"#{project.human_merge_method} to #{target_ref} is currently not supported." "#{project.human_merge_method} to #{target_ref} is currently not supported."
elsif !hooks_validation_pass?(merge_request) elsif !hooks_validation_pass?(merge_request)
hooks_validation_error(merge_request) hooks_validation_error(merge_request)
......
...@@ -74,6 +74,15 @@ describe MergeRequests::MergeToRefService do ...@@ -74,6 +74,15 @@ describe MergeRequests::MergeToRefService do
process_merge_to_ref process_merge_to_ref
end end
it 'returns error when feature is disabled' do
stub_feature_flags(merge_to_tmp_merge_ref_path: false)
result = service.execute(merge_request)
expect(result[:status]).to eq(:error)
expect(result[:message]).to eq('Feature is not enabled')
end
it 'returns an error when the failing to process the merge' do it 'returns an error when the failing to process the merge' do
allow(project.repository).to receive(:merge_to_ref).and_return(nil) allow(project.repository).to receive(:merge_to_ref).and_return(nil)
......
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