diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-01-08 13:56:39 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-01-08 13:56:39 +0300 |
commit | 08213ed4f5d35b582f0345d6a825737ced98fd05 (patch) | |
tree | f553aced5c87acce551781a1023d04a04d5a054c /spec | |
parent | 26a54ec34d9bb11656fb2a7a36d1a666218fc61d (diff) | |
parent | 8386edafd13c8cca1c6ed45abbbc554351300e9d (diff) |
Merge branch 'accept-2xx-status-codes-for-webhooks' into 'master'
Accept 2xx status codes for successful Web hook triggers
Closes https://github.com/gitlabhq/gitlabhq/issues/9956
See merge request !2332
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/hooks/web_hook_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/models/hooks/web_hook_spec.rb b/spec/models/hooks/web_hook_spec.rb index 2d90b0793cc..7070aa4ac62 100644 --- a/spec/models/hooks/web_hook_spec.rb +++ b/spec/models/hooks/web_hook_spec.rb @@ -77,5 +77,17 @@ describe ProjectHook, models: true do expect(@project_hook.execute(@data, 'push_hooks')).to eq([false, 'SSL error']) end + + it "handles 200 status code" do + WebMock.stub_request(:post, @project_hook.url).to_return(status: 200, body: "Success") + + expect(@project_hook.execute(@data, 'push_hooks')).to eq([true, 'Success']) + end + + it "handles 2xx status codes" do + WebMock.stub_request(:post, @project_hook.url).to_return(status: 201, body: "Success") + + expect(@project_hook.execute(@data, 'push_hooks')).to eq([true, 'Success']) + end end end |