diff options
author | Michael Kozono <mkozono@gmail.com> | 2019-04-15 22:44:38 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-04-17 15:21:06 +0300 |
commit | 635eee0d1c54ec27b0e9908a098b224d31a9e843 (patch) | |
tree | 80b9e0773cd7c3b391f9d544c4382a55efa6d14c /spec | |
parent | 06e75f0c147b7ca2f307ef15caebe16c27a83854 (diff) |
Merge branch 'sh-fix-merge-requests-api-remove-branch-param' into 'master'
Fix remove_source_branch merge request API handling
Closes #60530
See merge request gitlab-org/gitlab-ce!27392
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/merge_requests_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 7ffa365c651..e148f6033a3 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -1527,6 +1527,32 @@ describe API::MergeRequests do end describe "PUT /projects/:id/merge_requests/:merge_request_iid" do + context 'updates force_remove_source_branch properly' do + it 'sets to false' do + merge_request.update(merge_params: { 'force_remove_source_branch' => true } ) + + expect(merge_request.force_remove_source_branch?).to be_truthy + + put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}", user), params: { state_event: "close", remove_source_branch: false } + + expect(response).to have_gitlab_http_status(200) + expect(json_response['state']).to eq('closed') + expect(json_response['force_remove_source_branch']).to be_falsey + end + + it 'sets to true' do + merge_request.update(merge_params: { 'force_remove_source_branch' => false } ) + + expect(merge_request.force_remove_source_branch?).to be_falsey + + put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}", user), params: { state_event: "close", remove_source_branch: true } + + expect(response).to have_gitlab_http_status(200) + expect(json_response['state']).to eq('closed') + expect(json_response['force_remove_source_branch']).to be_truthy + end + end + context "to close a MR" do it "returns merge_request" do put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}", user), params: { state_event: "close" } |