diff options
author | Sebastian Ziebell <sebastian.ziebell@asquera.de> | 2013-03-07 17:56:11 +0100 |
---|---|---|
committer | Sebastian Ziebell <sebastian.ziebell@asquera.de> | 2013-03-07 17:56:11 +0100 |
commit | 32f1eaaf0f966ccc45635693679bcc8658e71815 (patch) | |
tree | fb2b5dc19ea14ae1e9fb3f50b896e4e047f8e21d /spec/requests/api/system_hooks_spec.rb | |
parent | ecf53bb9e616b724bafc939d5e74744e774e3fd2 (diff) | |
download | gitlab-ce-32f1eaaf0f966ccc45635693679bcc8658e71815.tar.gz |
API: system hooks API functions and documentation updated
* updated system hooks documentation and code comments
* fixed access to system hooks if no user given resulting in a `500 Server Error`
* added tests
Diffstat (limited to 'spec/requests/api/system_hooks_spec.rb')
-rw-r--r-- | spec/requests/api/system_hooks_spec.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/requests/api/system_hooks_spec.rb b/spec/requests/api/system_hooks_spec.rb index 9842ae91ec3..fe1b324c921 100644 --- a/spec/requests/api/system_hooks_spec.rb +++ b/spec/requests/api/system_hooks_spec.rb @@ -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
\ No newline at end of file |