Project

General

Profile

Misc #10721 » dns_lookup_v2.patch

anthonycrumley (Anthony Crumley), 01/10/2015 12:32 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
......
end
def test_failure_message_includes_failed_domain_and_port
begin
Net::HTTP.get(URI.parse("http://doesnotexist.bogus"))
fail "should have raised"
rescue => e
assert_includes e.message, "doesnotexist.bogus:80"
e = assert_raises(RuntimeError) do
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
end
assert_includes e.message, "doesnotexist.bogus:80"
end
end
(2-2/2)