diff options
author | Shinya Maeda <shinya@gitlab.com> | 2019-03-29 14:56:40 +0700 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2019-04-01 14:02:57 +0700 |
commit | a7d4824ded0c5ae6a155d7bdc87a1ba71eb3df5c (patch) | |
tree | 855a0cd3c16093fb76f38738876da23da6b2ccc1 /spec/services/merge_requests | |
parent | 093629fedc43e8b481c6626765e3fcf0603add17 (diff) | |
download | gitlab-ce-a7d4824ded0c5ae6a155d7bdc87a1ba71eb3df5c.tar.gz |
Check mergeability in merge to ref servicecheck-mergeability-in-merge-to-ref-service
and add spec
Add changelog
ok
ok
Diffstat (limited to 'spec/services/merge_requests')
-rw-r--r-- | spec/services/merge_requests/merge_to_ref_service_spec.rb | 20 |
1 files changed, 11 insertions, 9 deletions
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 fabca8f6b4a..a3b48abae26 100644 --- a/spec/services/merge_requests/merge_to_ref_service_spec.rb +++ b/spec/services/merge_requests/merge_to_ref_service_spec.rb @@ -40,15 +40,6 @@ describe MergeRequests::MergeToRefService do end shared_examples_for 'successfully evaluates pre-condition checks' do - 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) @@ -180,6 +171,17 @@ describe MergeRequests::MergeToRefService do it { expect(todo).not_to be_done } end + context 'when merge request is WIP state' do + it 'fails to merge' do + merge_request = create(:merge_request, title: 'WIP: The feature') + + result = service.execute(merge_request) + + expect(result[:status]).to eq(:error) + expect(result[:message]).to eq("Merge request is not mergeable to #{merge_request.merge_ref_path}") + end + end + it 'returns error when user has no authorization to admin the merge request' do unauthorized_user = create(:user) project.add_reporter(unauthorized_user) |