diff options
author | Akos Gyimesi <akos@gyim.hu> | 2018-01-13 14:06:03 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-12-06 20:20:08 +0300 |
commit | 5fd5dad492a2918c10633996bb29d656a4e9137a (patch) | |
tree | 95f07d6d53289920cd9c24771d6cb9e7318fce8d /spec/controllers/projects | |
parent | 2e3cefa6cdeabe9bfd169df9ed280895deb57be3 (diff) |
Improve error message when attempting to reopen MR and there's a new open MR for the same branch
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r-- | spec/controllers/projects/merge_requests_controller_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index e62523c65c9..9e8ec99e314 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -290,6 +290,18 @@ describe Projects::MergeRequestsController do it_behaves_like 'update invalid issuable', MergeRequest end + + context 'there are two merge requests with the same source branch' do + it "does not allow to reopen a closed merge request if another one is open" do + merge_request.close! + create(:merge_request, source_project: merge_request.source_project, source_branch: merge_request.source_branch) + + update_merge_request(state_event: 'reopen') + + expect(controller).to set_flash[:alert].to(/another open Merge Request already exists for this source branch/) + expect(merge_request.reload).to be_closed + end + end end describe 'POST merge' do |