Commit ba1a453ef3dddf50a2c118f4490267b19a0b2cc8
Exists in
master
and in
4 other branches
Merge pull request #3053 from m4tthumphrey/api-delete-hook-by-id
Fix RESTfulness of project hook deletions by API
Showing
3 changed files
with
6 additions
and
8 deletions
Show diff stats
doc/api/projects.md
lib/api/projects.rb
... | ... | @@ -205,8 +205,8 @@ module Gitlab |
205 | 205 | # id (required) - The ID of a project |
206 | 206 | # hook_id (required) - The ID of hook to delete |
207 | 207 | # Example Request: |
208 | - # DELETE /projects/:id/hooks | |
209 | - delete ":id/hooks" do | |
208 | + # DELETE /projects/:id/hooks/:hook_id | |
209 | + delete ":id/hooks/:hook_id" do | |
210 | 210 | authorize! :admin_project, user_project |
211 | 211 | @hook = user_project.hooks.find(params[:hook_id]) |
212 | 212 | @hook.destroy | ... | ... |
spec/requests/api/projects_spec.rb
... | ... | @@ -261,7 +261,7 @@ describe Gitlab::API do |
261 | 261 | it "should add hook to project" do |
262 | 262 | expect { |
263 | 263 | post api("/projects/#{project.id}/hooks", user), |
264 | - "url" => "http://example.com" | |
264 | + url: "http://example.com" | |
265 | 265 | }.to change {project.hooks.count}.by(1) |
266 | 266 | end |
267 | 267 | end |
... | ... | @@ -275,12 +275,10 @@ describe Gitlab::API do |
275 | 275 | end |
276 | 276 | end |
277 | 277 | |
278 | - | |
279 | - describe "DELETE /projects/:id/hooks" do | |
278 | + describe "DELETE /projects/:id/hooks/:hook_id" do | |
280 | 279 | it "should delete hook from project" do |
281 | 280 | expect { |
282 | - delete api("/projects/#{project.id}/hooks", user), | |
283 | - hook_id: hook.id | |
281 | + delete api("/projects/#{project.id}/hooks/#{hook.id}", user) | |
284 | 282 | }.to change {project.hooks.count}.by(-1) |
285 | 283 | end |
286 | 284 | end | ... | ... |