diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2018-12-07 18:12:38 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2018-12-07 18:12:38 +0300 |
commit | 69aaa30dd9e4211e081bf258e79fcfcfc2e8f230 (patch) | |
tree | 1f46e5d421f4e1c47f3949a05378b34437b0a894 /spec/controllers/projects | |
parent | b081614befa3d548e409c8a87bca34de652a9042 (diff) | |
parent | 1e3881b0003e604172dbdb859fa4fea2ed63ef2c (diff) |
Merge branch '22548-reopen-error-message' into 'master'
Improve error message when attempting to reopen MR and there's a new open MR for the same branch
Closes #22548
See merge request gitlab-org/gitlab-ce!22326
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r-- | spec/controllers/projects/merge_requests_controller_spec.rb | 14 |
1 files changed, 14 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..7f15da859e5 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -290,6 +290,20 @@ describe Projects::MergeRequestsController do it_behaves_like 'update invalid issuable', MergeRequest end + + context 'two merge requests with the same source branch' do + it 'does not allow a closed merge request to be reopened 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') + + errors = assigns[:merge_request].errors + + expect(errors[:validate_branches]).to include(/Another open merge request already exists for this source branch/) + expect(merge_request.reload).to be_closed + end + end end describe 'POST merge' do |