diff options
author | Rui Anderson <anderson.rui@gmail.com> | 2016-04-27 21:34:42 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-06-10 15:36:54 +0300 |
commit | 07dbd6b3884c4f188b2c3f29dd7419791f1051eb (patch) | |
tree | 6c00e4b9097f62a89fcd6f506a9c7b3eb27231bc /spec/requests/api/merge_requests_spec.rb | |
parent | cfc99bbd1390bc548a703fdc7857c7db5b0e7c13 (diff) |
Allow or not merge MR with failed build
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/requests/api/merge_requests_spec.rb')
-rw-r--r-- | spec/requests/api/merge_requests_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 9da69a913a8..91c25a0948f 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -419,6 +419,14 @@ describe API::API, api: true do expect(json_response['message']).to eq('405 Method Not Allowed') end + it "should return 405 if merge_request build is failed it's restrict to merge only when susccess" do + allow_any_instance_of(MergeRequest).to receive(:cannot_be_merged_because_build_failed?).and_return(true) + + put api("/projects/#{project.id}/merge_requests/#{merge_request.id}/merge", user) + expect(response.status).to eq(405) + expect(json_response['message']).to eq('405 Method Not Allowed') + end + it "should return 401 if user has no permissions to merge" do user2 = create(:user) project.team << [user2, :reporter] |