summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-12-07 15:12:38 +0000
committerFilipa Lacerda <filipa@gitlab.com>2018-12-07 15:12:38 +0000
commit69aaa30dd9e4211e081bf258e79fcfcfc2e8f230 (patch)
tree1f46e5d421f4e1c47f3949a05378b34437b0a894 /spec/controllers
parentb081614befa3d548e409c8a87bca34de652a9042 (diff)
parent1e3881b0003e604172dbdb859fa4fea2ed63ef2c (diff)
downloadgitlab-ce-69aaa30dd9e4211e081bf258e79fcfcfc2e8f230.tar.gz
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')
-rw-r--r--spec/controllers/projects/merge_requests_controller_spec.rb14
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