summaryrefslogtreecommitdiff
path: root/spec/models/hooks
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-01-07 06:28:24 -0800
committerStan Hu <stanhu@gmail.com>2016-01-07 06:28:24 -0800
commit8386edafd13c8cca1c6ed45abbbc554351300e9d (patch)
tree65f9a9f853aaf41851552531b330c51500b923ed /spec/models/hooks
parent61561a9eeb1dbb8273a1e8c8a5f37c0c01917c99 (diff)
downloadgitlab-ce-8386edafd13c8cca1c6ed45abbbc554351300e9d.tar.gz
Accept 2xx status codes for successful Web hook triggers
Closes https://github.com/gitlabhq/gitlabhq/issues/9956
Diffstat (limited to 'spec/models/hooks')
-rw-r--r--spec/models/hooks/web_hook_spec.rb12
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