summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-05-13 11:01:40 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-05-13 11:01:40 +0300
commitab032256da9f24351871143058343f7463f9d7fc (patch)
tree82b52ee627f6be2c7b6ae4e8311a33cc1d8ca2b7 /spec
parent5880d7df6253fc97024005e7c32dbc41def99aaf (diff)
downloadgitlab-ce-ab032256da9f24351871143058343f7463f9d7fc.tar.gz
Add some tests for merge API
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/merge_requests_spec.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb
index db7c30e1ab8..b47cbbee773 100644
--- a/spec/requests/api/merge_requests_spec.rb
+++ b/spec/requests/api/merge_requests_spec.rb
@@ -183,11 +183,18 @@ describe API::API, api: true do
end
end
- describe "PUT /projects/:id/merge_request/:merge_request_id to merge MR" do
- it "should return merge_request" do
- put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), state_event: "merge"
+ describe "PUT /projects/:id/merge_request/:merge_request_id/merge" do
+ it "should return merge_request in case of success" do
+ 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
- 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