summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-20 05:22:38 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-20 05:22:38 -0800
commitba1a453ef3dddf50a2c118f4490267b19a0b2cc8 (patch)
treef3bb8ab3954e1361a978633becba3503725c8b90
parentb7ac654b88aa9b03f431d93c25e397ff2bc66a7a (diff)
parentdddf6eab2dc01dd2ac685f142a61824523fea50b (diff)
downloadgitlab-ce-ba1a453ef3dddf50a2c118f4490267b19a0b2cc8.tar.gz
Merge pull request #3053 from m4tthumphrey/api-delete-hook-by-id
Fix RESTfulness of project hook deletions by API
-rw-r--r--doc/api/projects.md2
-rw-r--r--lib/api/projects.rb4
-rw-r--r--spec/requests/api/projects_spec.rb8
3 files changed, 6 insertions, 8 deletions
diff --git a/doc/api/projects.md b/doc/api/projects.md
index 13c53880db0..ed9690f09a2 100644
--- a/doc/api/projects.md
+++ b/doc/api/projects.md
@@ -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:
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 921aa237f26..631ed535459 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -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
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index 586f108ca9e..d410885bd22 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -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