diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-04-27 11:22:33 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-04-27 11:22:33 +0300 |
commit | 38e2ae5ae0a8e0ca5baefbd0ffc41cc11eba2db1 (patch) | |
tree | d4a198282d540f549811fe35de73b7b3b3d06f8d /spec | |
parent | 7ee1d68e0dae07a9dfefd51994c848449d8b6e11 (diff) | |
parent | 548f182814acd0f7a110e6c165c186e345901b00 (diff) | |
download | gitlab-ce-38e2ae5ae0a8e0ca5baefbd0ffc41cc11eba2db1.tar.gz |
Merge pull request #8644 from Bugagazavr/hook-events
Add X-GitLab-Event header for web hooks
Diffstat (limited to 'spec')
-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..14f873e6b5a 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 |