diff options
author | bugagazavr <kirik910@gmail.com> | 2015-01-24 03:10:43 +0300 |
---|---|---|
committer | Kirill Zaitsev <kirik910@gmail.com> | 2015-05-08 16:49:03 +0300 |
commit | acac7889023de96af61d293d855c33996bd780a1 (patch) | |
tree | 83d3d7ef3e7a12eca12843bccf92b6bd080b648a /spec/models/hooks/web_hook_spec.rb | |
parent | 0fc6f0b5d406f530e9ad8a35f0188536f6525cb9 (diff) |
Added X-GitLab-Event header for web hooks
Diffstat (limited to 'spec/models/hooks/web_hook_spec.rb')
-rw-r--r-- | spec/models/hooks/web_hook_spec.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/spec/models/hooks/web_hook_spec.rb b/spec/models/hooks/web_hook_spec.rb index 67ec9193ad7..9f5ef3eff70 100644 --- a/spec/models/hooks/web_hook_spec.rb +++ b/spec/models/hooks/web_hook_spec.rb @@ -52,22 +52,26 @@ describe ProjectHook do end it "POSTs to the web hook URL" do - @project_hook.execute(@data) - expect(WebMock).to have_requested(:post, @project_hook.url).once + @project_hook.execute(@data, 'push_hooks') + expect(WebMock).to have_requested(:post, @project_hook.url).with( + headers: {'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'Push Hook'} + ).once end it "POSTs the data as JSON" do json = @data.to_json - @project_hook.execute(@data) - expect(WebMock).to have_requested(:post, @project_hook.url).with(body: json).once + @project_hook.execute(@data, 'push_hooks') + expect(WebMock).to have_requested(:post, @project_hook.url).with( + headers: {'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'Push Hook'} + ).once end it "catches exceptions" do expect(WebHook).to receive(:post).and_raise("Some HTTP Post error") expect { - @project_hook.execute(@data) + @project_hook.execute(@data, 'push_hooks') }.to raise_error end end |