Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-12-02 03:15:01 +0300
committerStan Hu <stanhu@gmail.com>2015-12-04 18:13:28 +0300
commita120b78940b6c7150f405091d620b34c0fccbd28 (patch)
treef6463868c2b4faebbae0e6dd738364ebc6c1088f /spec/models/hooks
parent238ca3e472a67d319521daa5aeab6455b4740cdb (diff)
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/models/hooks')
-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