зеркало из https://github.com/github/ruby.git
Use 127.0.0.1 instead of localhost in Addrinfo specs
* Solaries doesn't support Addrinfo.getaddrinfo('localhost', 80), but supports Addrinfo.getaddrinfo('127.0.0.1', 80). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
3405ea62b5
Коммит
08563f2e14
|
@ -2,7 +2,7 @@ require_relative '../spec_helper'
|
|||
|
||||
describe 'Addrinfo.foreach' do
|
||||
it 'yields Addrinfo instances to the supplied block' do
|
||||
Addrinfo.foreach('localhost', 80) do |addr|
|
||||
Addrinfo.foreach('127.0.0.1', 80) do |addr|
|
||||
addr.should be_an_instance_of(Addrinfo)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,14 +2,12 @@ require_relative '../spec_helper'
|
|||
require_relative '../fixtures/classes'
|
||||
|
||||
describe 'Addrinfo.getaddrinfo' do
|
||||
platform_is_not :solaris do
|
||||
it 'returns an Array of Addrinfo instances' do
|
||||
array = Addrinfo.getaddrinfo('localhost', 80)
|
||||
array = Addrinfo.getaddrinfo('127.0.0.1', 80)
|
||||
|
||||
array.should be_an_instance_of(Array)
|
||||
array[0].should be_an_instance_of(Addrinfo)
|
||||
end
|
||||
end
|
||||
|
||||
SocketSpecs.each_ip_protocol do |family, ip_address|
|
||||
it 'sets the IP address of the Addrinfo instances' do
|
||||
|
@ -51,9 +49,9 @@ describe 'Addrinfo.getaddrinfo' do
|
|||
end
|
||||
end
|
||||
|
||||
platform_is_not :solaris, :windows do
|
||||
platform_is_not :windows do
|
||||
it 'sets the default socket type of the Addrinfo instances' do
|
||||
array = Addrinfo.getaddrinfo('localhost', 80)
|
||||
array = Addrinfo.getaddrinfo('127.0.0.1', 80)
|
||||
possible = [Socket::SOCK_STREAM, Socket::SOCK_DGRAM]
|
||||
|
||||
possible.should include(array[0].socktype)
|
||||
|
@ -61,14 +59,14 @@ describe 'Addrinfo.getaddrinfo' do
|
|||
end
|
||||
|
||||
it 'sets a custom socket type of the Addrinfo instances' do
|
||||
array = Addrinfo.getaddrinfo('localhost', 80, nil, Socket::SOCK_DGRAM)
|
||||
array = Addrinfo.getaddrinfo('127.0.0.1', 80, nil, Socket::SOCK_DGRAM)
|
||||
|
||||
array[0].socktype.should == Socket::SOCK_DGRAM
|
||||
end
|
||||
|
||||
platform_is_not :solaris, :windows do
|
||||
platform_is_not :windows do
|
||||
it 'sets the default socket protocol of the Addrinfo instances' do
|
||||
array = Addrinfo.getaddrinfo('localhost', 80)
|
||||
array = Addrinfo.getaddrinfo('127.0.0.1', 80)
|
||||
possible = [Socket::IPPROTO_TCP, Socket::IPPROTO_UDP]
|
||||
|
||||
possible.should include(array[0].protocol)
|
||||
|
@ -77,7 +75,7 @@ describe 'Addrinfo.getaddrinfo' do
|
|||
|
||||
platform_is_not :'solaris2.10' do # i386-solaris
|
||||
it 'sets a custom socket protocol of the Addrinfo instances' do
|
||||
array = Addrinfo.getaddrinfo('localhost', 80, nil, nil, Socket::IPPROTO_UDP)
|
||||
array = Addrinfo.getaddrinfo('127.0.0.1', 80, nil, nil, Socket::IPPROTO_UDP)
|
||||
|
||||
array[0].protocol.should == Socket::IPPROTO_UDP
|
||||
end
|
||||
|
@ -85,8 +83,7 @@ describe 'Addrinfo.getaddrinfo' do
|
|||
|
||||
platform_is_not :solaris do
|
||||
it 'sets the canonical name when AI_CANONNAME is given as a flag' do
|
||||
array = Addrinfo
|
||||
.getaddrinfo('localhost', 80, nil, nil, nil, Socket::AI_CANONNAME)
|
||||
array = Addrinfo.getaddrinfo('localhost', 80, nil, nil, nil, Socket::AI_CANONNAME)
|
||||
|
||||
array[0].canonname.should be_an_instance_of(String)
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче