Project

General

Profile

Misc #10721 » dns_lookup.patch

anthonycrumley (Anthony Crumley), 01/09/2015 06:29 AM

View differences:

test/net/http/test_http.rb
# coding: US-ASCII
require 'test/unit'
require 'minitest/autorun'
require 'net/http'
require 'stringio'
require_relative 'utils'
class TestNetHTTP < Test::Unit::TestCase
class TestNetHTTP < MiniTest::Unit::TestCase
def test_class_Proxy
no_proxy_class = Net::HTTP.Proxy nil
......
def test_failure_message_includes_failed_domain_and_port
begin
Net::HTTP.get(URI.parse("http://doesnotexist.bogus"))
fail "should have raised"
dns_lookup_failure_message = "SocketError: getaddrinfo: Name or service not known"
socket_open_failure = ->(_, _, _, _) { raise dns_lookup_failure_message }
TCPSocket.stub :open, socket_open_failure do
Net::HTTP.get(URI.parse("http://doesnotexist.bogus"))
end
rescue => e
assert_includes e.message, "doesnotexist.bogus:80"
end
(1-1/2)