summaryrefslogtreecommitdiff
path: root/spec/requests/api
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-11-03 16:05:40 +0000
committerRémy Coutable <remy@rymai.me>2016-11-03 16:05:40 +0000
commitd8153e31257c7a0ddc6123cc1a7d893a16e1b87a (patch)
tree0cefd42a039c646b930655742f57f627e7d112c0 /spec/requests/api
parentd54f3a10efa7f40b4368cb19fe32c98804d6c0bd (diff)
parent37f229c7358a48c6a9af3481927e9e4faee17e3d (diff)
downloadgitlab-ce-d8153e31257c7a0ddc6123cc1a7d893a16e1b87a.tar.gz
Merge branch 'zj-expose-system-hooks' into 'master'
Expose more info for SystemHooks See merge request !6964
Diffstat (limited to 'spec/requests/api')
-rw-r--r--spec/requests/api/system_hooks_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/requests/api/system_hooks_spec.rb b/spec/requests/api/system_hooks_spec.rb
index f8a1aed5441..f685a3685e6 100644
--- a/spec/requests/api/system_hooks_spec.rb
+++ b/spec/requests/api/system_hooks_spec.rb
@@ -13,6 +13,7 @@ describe API::API, api: true do
context "when no user" do
it "returns authentication error" do
get api("/hooks")
+
expect(response).to have_http_status(401)
end
end
@@ -20,6 +21,7 @@ describe API::API, api: true do
context "when not an admin" do
it "returns forbidden error" do
get api("/hooks", user)
+
expect(response).to have_http_status(403)
end
end
@@ -27,9 +29,12 @@ describe API::API, api: true do
context "when authenticated as admin" do
it "returns an array of hooks" do
get api("/hooks", admin)
+
expect(response).to have_http_status(200)
expect(json_response).to be_an Array
expect(json_response.first['url']).to eq(hook.url)
+ expect(json_response.first['push_events']).to be true
+ expect(json_response.first['tag_push_events']).to be false
end
end
end
@@ -43,6 +48,7 @@ describe API::API, api: true do
it "responds with 400 if url not given" do
post api("/hooks", admin)
+
expect(response).to have_http_status(400)
end
@@ -51,6 +57,14 @@ describe API::API, api: true do
post api("/hooks", admin)
end.not_to change { SystemHook.count }
end
+
+ it 'sets default values for events' do
+ post api('/hooks', admin), url: 'http://mep.mep', enable_ssl_verification: true
+
+ expect(response).to have_http_status(201)
+ expect(json_response['enable_ssl_verification']).to be true
+ expect(json_response['tag_push_events']).to be false
+ end
end
describe "GET /hooks/:id" do