diff options
author | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-10-18 20:10:08 +0200 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2016-10-31 13:42:29 +0100 |
commit | a4827ee2b9a5dd51356a4e11455c0075fe6cea69 (patch) | |
tree | 178aa0e6c5bf0c322690c8d9f5d5f335e195e2f0 /spec | |
parent | 76690017e28c2e42e58130fe64d7feb92d085b01 (diff) | |
download | gitlab-ce-a4827ee2b9a5dd51356a4e11455c0075fe6cea69.tar.gz |
Be able to POST subscriptions for system hooks
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/system_hooks_spec.rb | 14 |
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..cdf0874dbdc 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,13 @@ describe API::API, api: true do context "when authenticated as admin" do it "returns an array of hooks" do get api("/hooks", admin) + + byebug 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 @@ -51,6 +57,14 @@ describe API::API, api: true do post api("/hooks", admin) end.not_to change { SystemHook.count } end + + it 'allows the events to be selected' 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 |