Commit ab032256 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add some tests for merge API

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 5880d7df
...@@ -14,6 +14,7 @@ v 6.9.0 ...@@ -14,6 +14,7 @@ v 6.9.0
- Fix wiki backup skip bug - Fix wiki backup skip bug
- Two Step MR creation process - Two Step MR creation process
- Remove unwanted files from satellite working directory with git clean -fdx - Remove unwanted files from satellite working directory with git clean -fdx
- Accept merge request via API (sponsored by O'Reilly Media)
v 6.8.0 v 6.8.0
- Ability to at mention users that are participating in issue and merge req. discussion - Ability to at mention users that are participating in issue and merge req. discussion
......
...@@ -129,7 +129,7 @@ module API ...@@ -129,7 +129,7 @@ module API
:push_code :push_code
end end
if can?(current_user, action, project) if can?(current_user, action, user_project)
if merge_request.unchecked? if merge_request.unchecked?
merge_request.check_if_can_be_merged merge_request.check_if_can_be_merged
end end
......
...@@ -183,11 +183,18 @@ describe API::API, api: true do ...@@ -183,11 +183,18 @@ describe API::API, api: true do
end end
end end
describe "PUT /projects/:id/merge_request/:merge_request_id to merge MR" do describe "PUT /projects/:id/merge_request/:merge_request_id/merge" do
it "should return merge_request" do it "should return merge_request in case of success" do
put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), state_event: "merge" MergeRequest.any_instance.stub(can_be_merged?: true, automerge!: true)
put api("/projects/#{project.id}/merge_request/#{merge_request.id}/merge", user)
response.status.should == 200 response.status.should == 200
json_response['state'].should == 'merged' end
it "should return 405 if branch can't be merged" do
MergeRequest.any_instance.stub(can_be_merged?: false)
put api("/projects/#{project.id}/merge_request/#{merge_request.id}/merge", user)
response.status.should == 405
json_response['message'].should == 'Branch cannot be merged'
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment