mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	test_http.rb: test without DNS access
* test/net/http/test_http.rb: get rid of accessing DNS actually for some servers returning wrong results. [ruby-core:67454] [Bug #10721] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									b13432890f
								
							
						
					
					
						commit
						b4089826fb
					
				
					 2 changed files with 14 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -1,3 +1,9 @@
 | 
			
		|||
Tue Jan 13 14:16:35 2015  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* test/net/http/test_http.rb: get rid of accessing DNS actually
 | 
			
		||||
	  for some servers returning wrong results.
 | 
			
		||||
	  [ruby-core:67454] [Bug #10721]
 | 
			
		||||
 | 
			
		||||
Mon Jan 12 23:21:57 2015  NAKAMURA Usaku  <usa@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* gems/bundled_gems: update test-unit to 3.0.9.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -189,11 +189,14 @@ class TestNetHTTP < Test::Unit::TestCase
 | 
			
		|||
  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"
 | 
			
		||||
    # hostname to be included in the error message
 | 
			
		||||
    host = Struct.new(:to_s).new("<example>")
 | 
			
		||||
    port = 2119
 | 
			
		||||
    # hack to let TCPSocket.open fail
 | 
			
		||||
    def host.to_str; raise SocketError, "open failure"; end
 | 
			
		||||
    uri = Struct.new(:scheme, :hostname, :port).new("http", host, port)
 | 
			
		||||
    assert_raise_with_message(SocketError, /#{host}:#{port}/) do
 | 
			
		||||
      Net::HTTP.get(uri)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue