Merge pull request #3170 from Asquera/api/system_hooks_adjustments

API: system hook request functions and documentation updated
This commit is contained in:
Dmitriy Zaporozhets 2013-03-10 23:56:29 -07:00
commit a29c883b5b
3 changed files with 36 additions and 12 deletions

View file

@ -10,6 +10,13 @@ describe Gitlab::API do
before { stub_request(:post, hook.url) }
describe "GET /hooks" do
context "when no user" do
it "should return authentication error" do
get api("/hooks")
response.status.should == 401
end
end
context "when not an admin" do
it "should return forbidden error" do
get api("/hooks", user)
@ -34,9 +41,9 @@ describe Gitlab::API do
}.to change { SystemHook.count }.by(1)
end
it "should respond with 404 on failure" do
it "should respond with 400 if url not given" do
post api("/hooks", admin)
response.status.should == 404
response.status.should == 400
end
it "should not create new hook without url" do
@ -65,5 +72,10 @@ describe Gitlab::API do
delete api("/hooks/#{hook.id}", admin)
}.to change { SystemHook.count }.by(-1)
end
it "should return success if hook id not found" do
delete api("/hooks/12345", admin)
response.status.should == 200
end
end
end