Merge pull request #3053 from m4tthumphrey/api-delete-hook-by-id
Fix RESTfulness of project hook deletions by API
This commit is contained in:
commit
ba1a453ef3
3 changed files with 6 additions and 8 deletions
|
@ -265,7 +265,7 @@ Will return status `201 Created` on success, or `404 Not found` on fail.
|
||||||
Delete hook from project
|
Delete hook from project
|
||||||
|
|
||||||
```
|
```
|
||||||
DELETE /projects/:id/hooks
|
DELETE /projects/:id/hooks/:hook_id
|
||||||
```
|
```
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
|
|
@ -205,8 +205,8 @@ module Gitlab
|
||||||
# id (required) - The ID of a project
|
# id (required) - The ID of a project
|
||||||
# hook_id (required) - The ID of hook to delete
|
# hook_id (required) - The ID of hook to delete
|
||||||
# Example Request:
|
# Example Request:
|
||||||
# DELETE /projects/:id/hooks
|
# DELETE /projects/:id/hooks/:hook_id
|
||||||
delete ":id/hooks" do
|
delete ":id/hooks/:hook_id" do
|
||||||
authorize! :admin_project, user_project
|
authorize! :admin_project, user_project
|
||||||
@hook = user_project.hooks.find(params[:hook_id])
|
@hook = user_project.hooks.find(params[:hook_id])
|
||||||
@hook.destroy
|
@hook.destroy
|
||||||
|
|
|
@ -261,7 +261,7 @@ describe Gitlab::API do
|
||||||
it "should add hook to project" do
|
it "should add hook to project" do
|
||||||
expect {
|
expect {
|
||||||
post api("/projects/#{project.id}/hooks", user),
|
post api("/projects/#{project.id}/hooks", user),
|
||||||
"url" => "http://example.com"
|
url: "http://example.com"
|
||||||
}.to change {project.hooks.count}.by(1)
|
}.to change {project.hooks.count}.by(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -275,12 +275,10 @@ describe Gitlab::API do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "DELETE /projects/:id/hooks/:hook_id" do
|
||||||
describe "DELETE /projects/:id/hooks" do
|
|
||||||
it "should delete hook from project" do
|
it "should delete hook from project" do
|
||||||
expect {
|
expect {
|
||||||
delete api("/projects/#{project.id}/hooks", user),
|
delete api("/projects/#{project.id}/hooks/#{hook.id}", user)
|
||||||
hook_id: hook.id
|
|
||||||
}.to change {project.hooks.count}.by(-1)
|
}.to change {project.hooks.count}.by(-1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue