Sha256: 579ff76b80c73ba037b18b01d904a0168c84a45bd9efb45b106f3d11fe699a85
Contents?: true
Size: 1.09 KB
Versions: 16
Compression:
Stored size: 1.09 KB
Contents
require 'spec_helper' # The adapter NetHttp must be required before the SocketError (used below) is accessible require 'faraday/adapter/net_http' describe PuppetForge::Connection::ConnectionFailure do subject do Faraday.new('https://my-site.url/some-path') do |builder| builder.use(:connection_failure) builder.adapter :test do |stub| stub.get('/connectfail') { raise Faraday::ConnectionFailed.new(SocketError.new("getaddrinfo: Name or service not known"), :hi) } end end end it "includes the base URL in the error message" do expect { subject.get('/connectfail') }.to raise_error(Faraday::ConnectionFailed, "Unable to connect to https://my-site.url: getaddrinfo: Name or service not known") end it "includes the proxy host in the error message when set" do subject.proxy('https://some-unreachable.proxy:3128') expect { subject.get('/connectfail') }.to raise_error(Faraday::ConnectionFailed, "Unable to connect to https://my-site.url (using proxy https://some-unreachable.proxy:3128): getaddrinfo: Name or service not known") end end
Version data entries
16 entries across 16 versions & 1 rubygems