Commit f0e417091c2cef32b560472a38f66cf6cdcaec15

Authored by Sebastian Ziebell
2 parents 512d826c ba1a453e

Merge branch 'master' into fixes/api

Conflicts:
	spec/requests/api/projects_spec.rb
doc/api/projects.md
@@ -354,7 +354,7 @@ Removes a hook from project. This is an idempotent method and can be called mult @@ -354,7 +354,7 @@ Removes a hook from project. This is an idempotent method and can be called mult
354 Either the hook is available or not. 354 Either the hook is available or not.
355 355
356 ``` 356 ```
357 -DELETE /projects/:id/hooks 357 +DELETE /projects/:id/hooks/:hook_id
358 ``` 358 ```
359 359
360 Parameters: 360 Parameters:
lib/api/projects.rb
@@ -244,8 +244,8 @@ module Gitlab @@ -244,8 +244,8 @@ module Gitlab
244 # id (required) - The ID of a project 244 # id (required) - The ID of a project
245 # hook_id (required) - The ID of hook to delete 245 # hook_id (required) - The ID of hook to delete
246 # Example Request: 246 # Example Request:
247 - # DELETE /projects/:id/hooks  
248 - delete ":id/hooks" do 247 + # DELETE /projects/:id/hooks/:hook_id
  248 + delete ":id/hooks/:hook_id" do
249 authorize! :admin_project, user_project 249 authorize! :admin_project, user_project
250 bad_request!(:hook_id) unless params.has_key? :hook_id 250 bad_request!(:hook_id) unless params.has_key? :hook_id
251 251
spec/requests/api/projects_spec.rb
@@ -384,7 +384,7 @@ describe Gitlab::API do @@ -384,7 +384,7 @@ describe Gitlab::API do
384 it "should add hook to project" do 384 it "should add hook to project" do
385 expect { 385 expect {
386 post api("/projects/#{project.id}/hooks", user), 386 post api("/projects/#{project.id}/hooks", user),
387 - "url" => "http://example.com" 387 + url: "http://example.com"
388 }.to change {project.hooks.count}.by(1) 388 }.to change {project.hooks.count}.by(1)
389 response.status.should == 201 389 response.status.should == 201
390 end 390 end
@@ -424,11 +424,10 @@ describe Gitlab::API do @@ -424,11 +424,10 @@ describe Gitlab::API do
424 end 424 end
425 end 425 end
426 426
427 - describe "DELETE /projects/:id/hooks" do 427 + describe "DELETE /projects/:id/hooks/:hook_id" do
428 it "should delete hook from project" do 428 it "should delete hook from project" do
429 expect { 429 expect {
430 - delete api("/projects/#{project.id}/hooks", user),  
431 - hook_id: hook.id 430 + delete api("/projects/#{project.id}/hooks/#{hook.id}", user)
432 }.to change {project.hooks.count}.by(-1) 431 }.to change {project.hooks.count}.by(-1)
433 response.status.should == 200 432 response.status.should == 200
434 end 433 end