diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2019-02-12 08:22:44 -0200 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2019-02-25 10:41:02 -0300 |
commit | 4e16edbe0a26d95ea94ad61ebaadac4f7463352b (patch) | |
tree | 1a92fb9c26041034e6b86aaf1507601ae30e42c0 | |
parent | 105212ce49007ffc3489c2039e55056d8df8fa95 (diff) | |
download | gitlab-ce-4e16edbe0a26d95ea94ad61ebaadac4f7463352b.tar.gz |
Add feature-flag support
Returns error in MergeToRefService when
merge_to_tmp_merge_ref_path ff is disabled.
-rw-r--r-- | app/services/merge_requests/merge_to_ref_service.rb | 4 | ||||
-rw-r--r-- | spec/services/merge_requests/merge_to_ref_service_spec.rb | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/app/services/merge_requests/merge_to_ref_service.rb b/app/services/merge_requests/merge_to_ref_service.rb index 6b99c4fc483..ed62c3424bd 100644 --- a/app/services/merge_requests/merge_to_ref_service.rb +++ b/app/services/merge_requests/merge_to_ref_service.rb @@ -34,7 +34,9 @@ module MergeRequests def error_check! 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." elsif !hooks_validation_pass?(merge_request) hooks_validation_error(merge_request) diff --git a/spec/services/merge_requests/merge_to_ref_service_spec.rb b/spec/services/merge_requests/merge_to_ref_service_spec.rb index 696f1b83157..96f2fde7117 100644 --- a/spec/services/merge_requests/merge_to_ref_service_spec.rb +++ b/spec/services/merge_requests/merge_to_ref_service_spec.rb @@ -74,6 +74,15 @@ describe MergeRequests::MergeToRefService do process_merge_to_ref 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 allow(project.repository).to receive(:merge_to_ref).and_return(nil) |