diff options
author | Toon Claes <toon@iotcl.com> | 2016-09-21 17:15:12 +0300 |
---|---|---|
committer | Toon Claes <toon@iotcl.com> | 2016-11-09 23:04:03 +0300 |
commit | 1afab9eb79c87f32c7b899e58bc9a0ea8a113594 (patch) | |
tree | 33068aabffdb6b76c0489246429a3a71c2b748a4 /spec/requests/api/branches_spec.rb | |
parent | c392b0cc24ba40e3fed920c6c693cb24665193af (diff) |
Add button to delete all merged branches
It adds a button to the branches page that the user can use to delete
all the branches that are already merged. This can be used to clean up
all the branches that were forgotten to delete while merging MRs.
Fixes #21076.
Diffstat (limited to 'spec/requests/api/branches_spec.rb')
-rw-r--r-- | spec/requests/api/branches_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb index 1711096f4bd..8f605757186 100644 --- a/spec/requests/api/branches_spec.rb +++ b/spec/requests/api/branches_spec.rb @@ -299,4 +299,20 @@ describe API::API, api: true do expect(json_response['message']).to eq('Cannot remove HEAD branch') end end + + describe "DELETE /projects/:id/repository/merged_branches" do + before do + allow_any_instance_of(Repository).to receive(:rm_branch).and_return(true) + end + + it 'returns 200' do + delete api("/projects/#{project.id}/repository/merged_branches", user) + expect(response).to have_http_status(200) + end + + it 'returns a 403 error if guest' do + delete api("/projects/#{project.id}/repository/merged_branches", user2) + expect(response).to have_http_status(403) + end + end end |