summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-12-01 16:15:01 -0800
committerStan Hu <stanhu@gmail.com>2015-12-04 07:13:28 -0800
commita120b78940b6c7150f405091d620b34c0fccbd28 (patch)
treef6463868c2b4faebbae0e6dd738364ebc6c1088f /spec
parent238ca3e472a67d319521daa5aeab6455b4740cdb (diff)
downloadgitlab-ce-a120b78940b6c7150f405091d620b34c0fccbd28.tar.gz
Handle and report SSL errors in Web hook test. Check for status 200 for success.
If a Web hook test fails due to an SSL error or some other error, report the result back to the user instead of an Error 500. Closes #3656 Handle response
Diffstat (limited to 'spec')
-rw-r--r--spec/models/hooks/web_hook_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/models/hooks/web_hook_spec.rb b/spec/models/hooks/web_hook_spec.rb
index 2fdc49f02ee..35042788c65 100644
--- a/spec/models/hooks/web_hook_spec.rb
+++ b/spec/models/hooks/web_hook_spec.rb
@@ -71,5 +71,11 @@ describe ProjectHook do
expect { @project_hook.execute(@data, 'push_hooks') }.to raise_error(RuntimeError)
end
+
+ it "handles SSL exceptions" do
+ expect(WebHook).to receive(:post).and_raise(OpenSSL::SSL::SSLError.new('SSL error'))
+
+ expect(@project_hook.execute(@data, 'push_hooks')).to eq([false, 'SSL error'])
+ end
end
end