diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-05-13 13:20:10 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-05-13 13:20:10 +0300 |
commit | 2d2b2da45a586bdf29e115dcb4b4f66f9a1feed0 (patch) | |
tree | 04631804308cd9f0048860a3ed716e7382af17b0 | |
parent | ab032256da9f24351871143058343f7463f9d7fc (diff) | |
download | gitlab-ce-2d2b2da45a586bdf29e115dcb4b4f66f9a1feed0.tar.gz |
More tests for merge api
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r-- | spec/requests/api/merge_requests_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index b47cbbee773..2fb3684fdf0 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -196,6 +196,21 @@ describe API::API, api: true do response.status.should == 405 json_response['message'].should == 'Branch cannot be merged' end + + it "should return 405 if merge_request is not open" do + merge_request.close + put api("/projects/#{project.id}/merge_request/#{merge_request.id}/merge", user) + response.status.should == 405 + json_response['message'].should == 'Method Not Allowed' + end + + it "should return 401 if user has no permissions to merge" do + user2 = create(:user) + project.team << [user2, :reporter] + put api("/projects/#{project.id}/merge_request/#{merge_request.id}/merge", user2) + response.status.should == 401 + json_response['message'].should == '401 Unauthorized' + end end describe "PUT /projects/:id/merge_request/:merge_request_id" do |