diff options
author | Oswaldo <oswaldo@gitlab.com> | 2017-02-22 14:37:13 -0300 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-02-23 19:55:13 -0300 |
commit | 2b001d9e7a2136a6d670576843a953115a5c7c25 (patch) | |
tree | 37fbbc6ed8001b30bc9939045d0e9e7695837dba /spec/requests/api/v3/branches_spec.rb | |
parent | 2fb3fcf0c0446c9a1568e26e81d49f3b5ce159dc (diff) | |
download | gitlab-ce-2b001d9e7a2136a6d670576843a953115a5c7c25.tar.gz |
Return 202 with JSON body on async removals on V4 API3874-correctly-return-json-on-delete-responses
Diffstat (limited to 'spec/requests/api/v3/branches_spec.rb')
-rw-r--r-- | spec/requests/api/v3/branches_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/requests/api/v3/branches_spec.rb b/spec/requests/api/v3/branches_spec.rb index 0e4c6bc3bc6..a3e1581fcc5 100644 --- a/spec/requests/api/v3/branches_spec.rb +++ b/spec/requests/api/v3/branches_spec.rb @@ -20,4 +20,25 @@ describe API::V3::Branches, api: true do expect(branch_names).to match_array(project.repository.branch_names) 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 v3_api("/projects/#{project.id}/repository/merged_branches", user) + + expect(response).to have_http_status(200) + end + + it 'returns a 403 error if guest' do + user_b = create :user + create(:project_member, :guest, user: user_b, project: project) + + delete v3_api("/projects/#{project.id}/repository/merged_branches", user_b) + + expect(response).to have_http_status(403) + end + end end |