SSL connections from ruby are unable to verify a cert that curl and openssl are able to. Below i use the same cert.pem file for both curl and ruby but get different outcomes.
In irb:
> irb(main):004:0> http = Net::HTTP.new("localhost", 4000)
> irb(main):006:0> http.use_ssl = true
> irb(main):007:0> http.cert_store = OpenSSL::X509::Store.new
> irb(main):008:0> http.cert_store.add_file('/usr/local/etc/openssl/cert.pem')
> irb(main):009:0> http.request_get("/")
> OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed