Sha256: 49b1f9cb450841b72ac7abe2e774344e96cc60c72b6fa512cef6355b023ce816

Contents?: true

Size: 878 Bytes

Versions: 3

Compression:

Stored size: 878 Bytes

Contents

require File.dirname(__FILE__) + '/../base'

describe RestClient::Request do
  describe "ssl verification" do
    it "is successful with the correct ca_file" do
      request = RestClient::Request.new(
        :method => :get,
        :url => 'https://www.google.com',
        :verify_ssl => OpenSSL::SSL::VERIFY_PEER,
        :ssl_ca_file => File.join(File.dirname(__FILE__), "certs", "verisign.crt")
      )
      expect { request.execute }.to_not raise_error
    end

    it "is unsuccessful with an incorrect ca_file" do
      request = RestClient::Request.new(
        :method => :get,
        :url => 'https://www.google.com',
        :verify_ssl => OpenSSL::SSL::VERIFY_PEER,
        :ssl_ca_file => File.join(File.dirname(__FILE__), "certs", "equifax.crt")
      )
      expect { request.execute }.to raise_error(RestClient::SSLCertificateNotVerified)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rest-client-1.6.0 spec/integration/request_spec.rb
rest-client-1.6.0.a spec/integration/request_spec.rb
rest-client-1.5.1 spec/integration/request_spec.rb