diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-18 19:35:54 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-18 19:35:54 +0000 |
commit | 08563f2e14853e43f0efd9e005fd793a2a58e445 (patch) | |
tree | e3cb96294411a53b8d80cefe051c4b8b33854930 /spec | |
parent | 3405ea62b5989281a4ddfa4f64db9e6a8624a500 (diff) | |
download | ruby-08563f2e14853e43f0efd9e005fd793a2a58e445.tar.gz |
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
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ruby/library/socket/addrinfo/foreach_spec.rb | 2 | ||||
-rw-r--r-- | spec/ruby/library/socket/addrinfo/getaddrinfo_spec.rb | 25 |
2 files changed, 12 insertions, 15 deletions
diff --git a/spec/ruby/library/socket/addrinfo/foreach_spec.rb b/spec/ruby/library/socket/addrinfo/foreach_spec.rb index 75c1d1dea2..6ec8fab905 100644 --- a/spec/ruby/library/socket/addrinfo/foreach_spec.rb +++ b/spec/ruby/library/socket/addrinfo/foreach_spec.rb @@ -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 diff --git a/spec/ruby/library/socket/addrinfo/getaddrinfo_spec.rb b/spec/ruby/library/socket/addrinfo/getaddrinfo_spec.rb index ae6d527ac8..67fad73815 100644 --- a/spec/ruby/library/socket/addrinfo/getaddrinfo_spec.rb +++ b/spec/ruby/library/socket/addrinfo/getaddrinfo_spec.rb @@ -2,13 +2,11 @@ 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) + it 'returns an Array of Addrinfo instances' do + array = Addrinfo.getaddrinfo('127.0.0.1', 80) - array.should be_an_instance_of(Array) - array[0].should be_an_instance_of(Addrinfo) - end + array.should be_an_instance_of(Array) + array[0].should be_an_instance_of(Addrinfo) end SocketSpecs.each_ip_protocol do |family, ip_address| @@ -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 |