diff options
author | Rémy Coutable <remy@rymai.me> | 2016-04-13 12:10:57 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-04-13 12:10:57 +0300 |
commit | 8ea6c6d80c0942e0f2caee3caa0cd7503e51d45d (patch) | |
tree | db577bcf2a2bedadd069e152cb667848f4632833 /spec/controllers | |
parent | 6bb71869b8c003e9e880646afa35050821e7dac9 (diff) | |
parent | a64f1c763615c049e551c82a9f3a7c53525a172c (diff) |
Merge branch 'issue_15044' into 'master'
Allow to close invalid merge request
fixes #15044
See merge request !3664
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/merge_requests_controller_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index 75e6b6f45a7..c54e83339a1 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -157,6 +157,34 @@ describe Projects::MergeRequestsController do end end + describe 'PUT #update' do + context 'there is no source project' do + let(:project) { create(:project) } + let(:fork_project) { create(:forked_project_with_submodules) } + let(:merge_request) { create(:merge_request, source_project: fork_project, source_branch: 'add-submodule-version-bump', target_branch: 'master', target_project: project) } + + before do + fork_project.build_forked_project_link(forked_to_project_id: fork_project.id, forked_from_project_id: project.id) + fork_project.save + merge_request.reload + fork_project.destroy + end + + it 'closes MR without errors' do + post :update, + namespace_id: project.namespace.path, + project_id: project.path, + id: merge_request.iid, + merge_request: { + state_event: 'close' + } + + expect(response).to redirect_to([merge_request.target_project.namespace.becomes(Namespace), merge_request.target_project, merge_request]) + expect(merge_request.reload.closed?).to be_truthy + end + end + end + describe "DELETE #destroy" do it "denies access to users unless they're admin or project owner" do delete :destroy, namespace_id: project.namespace.path, project_id: project.path, id: merge_request.iid |