diff options
author | blackst0ne <blackst0ne.ru@gmail.com> | 2018-05-29 20:51:43 +1100 |
---|---|---|
committer | blackst0ne <blackst0ne.ru@gmail.com> | 2018-05-29 20:51:43 +1100 |
commit | 4cff66a6c46361e8d775ea3f5a80bf147d4020b3 (patch) | |
tree | f1f76411400f35f394fedd28ad03d42ccbaf990e /spec/requests/api/v3 | |
parent | 6e354cb642f911dc71be3d5368f066900fc25970 (diff) | |
download | gitlab-ce-4cff66a6c46361e8d775ea3f5a80bf147d4020b3.tar.gz |
Add 'squash and rebase' feature to CEblackst0ne-squash-and-merge-in-gitlab-core-ce
Diffstat (limited to 'spec/requests/api/v3')
-rw-r--r-- | spec/requests/api/v3/merge_requests_spec.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/spec/requests/api/v3/merge_requests_spec.rb b/spec/requests/api/v3/merge_requests_spec.rb index be70cb24dce..79a16fbd1b0 100644 --- a/spec/requests/api/v3/merge_requests_spec.rb +++ b/spec/requests/api/v3/merge_requests_spec.rb @@ -40,6 +40,7 @@ describe API::MergeRequests do expect(json_response.first['sha']).to eq(merge_request_merged.diff_head_sha) expect(json_response.first['merge_commit_sha']).not_to be_nil expect(json_response.first['merge_commit_sha']).to eq(merge_request_merged.merge_commit_sha) + expect(json_response.first['squash']).to eq(merge_request_merged.squash) end it "returns an array of all merge_requests" do @@ -241,13 +242,15 @@ describe API::MergeRequests do author: user, labels: 'label, label2', milestone_id: milestone.id, - remove_source_branch: true + remove_source_branch: true, + squash: true expect(response).to have_gitlab_http_status(201) expect(json_response['title']).to eq('Test merge_request') expect(json_response['labels']).to eq(%w(label label2)) expect(json_response['milestone']['id']).to eq(milestone.id) expect(json_response['force_remove_source_branch']).to be_truthy + expect(json_response['squash']).to be_truthy end it "returns 422 when source_branch equals target_branch" do @@ -489,6 +492,14 @@ describe API::MergeRequests do expect(response).to have_gitlab_http_status(200) end + it "updates the MR's squash attribute" do + expect do + put v3_api("/projects/#{project.id}/merge_requests/#{merge_request.id}/merge", user), squash: true + end.to change { merge_request.reload.squash } + + expect(response).to have_gitlab_http_status(200) + end + it "enables merge when pipeline succeeds if the pipeline is active" do allow_any_instance_of(MergeRequest).to receive(:head_pipeline).and_return(pipeline) allow(pipeline).to receive(:active?).and_return(true) @@ -529,6 +540,13 @@ describe API::MergeRequests do expect(json_response['milestone']['id']).to eq(milestone.id) end + it "updates squash and returns merge_request" do + put v3_api("/projects/#{project.id}/merge_requests/#{merge_request.id}", user), squash: true + + expect(response).to have_gitlab_http_status(200) + expect(json_response['squash']).to be_truthy + end + it "returns merge_request with renamed target_branch" do put v3_api("/projects/#{project.id}/merge_requests/#{merge_request.id}", user), target_branch: "wiki" expect(response).to have_gitlab_http_status(200) |