Permalink
Browse files

Tests the previous commits regarding SSL

  • Loading branch information...
1 parent 1379f63 commit fd891876fdbb915c2eaa3ff6d9d0a61222d6a0bc @jyurek jyurek committed Aug 8, 2011
Showing with 17 additions and 0 deletions.
  1. +17 −0 test/sender_test.rb
View
@@ -118,6 +118,23 @@ def stub_http(options = {})
real_http.stubs(:post => nil)
proxy = stub(:new => real_http)
Net::HTTP.stubs(:Proxy => proxy)
+ File.stubs(:exist?).with(OpenSSL::X509::DEFAULT_CERT_FILE).returns(false)
+
+ send_exception(:secure => true)
+ assert(real_http.use_ssl)
+ assert_equal(OpenSSL::SSL::VERIFY_PEER, real_http.verify_mode)
+ assert_nil real_http.ca_file
+ end
+
+ should "verify the SSL peer when the use_ssl option is set to true and the default cert exists" do
+ url = "https://hoptoadapp.com#{HoptoadNotifier::Sender::NOTICES_URI}"
+ uri = URI.parse(url)
+
+ real_http = Net::HTTP.new(uri.host, uri.port)
+ real_http.stubs(:post => nil)
+ proxy = stub(:new => real_http)
+ Net::HTTP.stubs(:Proxy => proxy)
+ File.stubs(:exist?).with(OpenSSL::X509::DEFAULT_CERT_FILE).returns(true)
send_exception(:secure => true)
assert(real_http.use_ssl)

0 comments on commit fd89187

Please sign in to comment.