Commit ba1a453e authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #3053 from m4tthumphrey/api-delete-hook-by-id

Fix RESTfulness of project hook deletions by API
parents b7ac654b dddf6eab
......@@ -265,7 +265,7 @@ Will return status `201 Created` on success, or `404 Not found` on fail.
Delete hook from project
```
DELETE /projects/:id/hooks
DELETE /projects/:id/hooks/:hook_id
```
Parameters:
......
......@@ -205,8 +205,8 @@ module Gitlab
# id (required) - The ID of a project
# hook_id (required) - The ID of hook to delete
# Example Request:
# DELETE /projects/:id/hooks
delete ":id/hooks" do
# DELETE /projects/:id/hooks/:hook_id
delete ":id/hooks/:hook_id" do
authorize! :admin_project, user_project
@hook = user_project.hooks.find(params[:hook_id])
@hook.destroy
......
......@@ -261,7 +261,7 @@ describe Gitlab::API do
it "should add hook to project" do
expect {
post api("/projects/#{project.id}/hooks", user),
"url" => "http://example.com"
url: "http://example.com"
}.to change {project.hooks.count}.by(1)
end
end
......@@ -275,12 +275,10 @@ describe Gitlab::API do
end
end
describe "DELETE /projects/:id/hooks" do
describe "DELETE /projects/:id/hooks/:hook_id" do
it "should delete hook from project" do
expect {
delete api("/projects/#{project.id}/hooks", user),
hook_id: hook.id
delete api("/projects/#{project.id}/hooks/#{hook.id}", user)
}.to change {project.hooks.count}.by(-1)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment