Commit 77d0e41df00c45aaafdec5fd6cdddce003c29445
1 parent
8b65d069
Exists in
master
and in
4 other branches
fix API route to delete project hook
Showing
2 changed files
with
5 additions
and
5 deletions
Show diff stats
lib/api/projects.rb
@@ -274,7 +274,7 @@ module Gitlab | @@ -274,7 +274,7 @@ module Gitlab | ||
274 | # hook_id (required) - The ID of hook to delete | 274 | # hook_id (required) - The ID of hook to delete |
275 | # Example Request: | 275 | # Example Request: |
276 | # DELETE /projects/:id/hooks/:hook_id | 276 | # DELETE /projects/:id/hooks/:hook_id |
277 | - delete ":id/hooks" do | 277 | + delete ":id/hooks/:hook_id" do |
278 | authorize! :admin_project, user_project | 278 | authorize! :admin_project, user_project |
279 | required_attributes! [:hook_id] | 279 | required_attributes! [:hook_id] |
280 | 280 |
spec/requests/api/projects_spec.rb
@@ -467,21 +467,21 @@ describe Gitlab::API do | @@ -467,21 +467,21 @@ describe Gitlab::API do | ||
467 | end | 467 | end |
468 | end | 468 | end |
469 | 469 | ||
470 | - describe "DELETE /projects/:id/hooks" do | 470 | + describe "DELETE /projects/:id/hooks/:hook_id" do |
471 | it "should delete hook from project" do | 471 | it "should delete hook from project" do |
472 | expect { | 472 | expect { |
473 | - delete api("/projects/#{project.id}/hooks", user), hook_id: hook.id | 473 | + delete api("/projects/#{project.id}/hooks/#{hook.id}", user) |
474 | }.to change {project.hooks.count}.by(-1) | 474 | }.to change {project.hooks.count}.by(-1) |
475 | response.status.should == 200 | 475 | response.status.should == 200 |
476 | end | 476 | end |
477 | 477 | ||
478 | it "should return success when deleting hook" do | 478 | it "should return success when deleting hook" do |
479 | - delete api("/projects/#{project.id}/hooks", user), hook_id: hook.id | 479 | + delete api("/projects/#{project.id}/hooks/#{hook.id}", user) |
480 | response.status.should == 200 | 480 | response.status.should == 200 |
481 | end | 481 | end |
482 | 482 | ||
483 | it "should return success when deleting non existent hook" do | 483 | it "should return success when deleting non existent hook" do |
484 | - delete api("/projects/#{project.id}/hooks", user), hook_id: 42 | 484 | + delete api("/projects/#{project.id}/hooks/42", user) |
485 | response.status.should == 200 | 485 | response.status.should == 200 |
486 | end | 486 | end |
487 | 487 |