diff options
Diffstat (limited to 'spec/ruby/library/socket/tcpsocket/gethostbyname_spec.rb')
| -rw-r--r-- | spec/ruby/library/socket/tcpsocket/gethostbyname_spec.rb | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/spec/ruby/library/socket/tcpsocket/gethostbyname_spec.rb b/spec/ruby/library/socket/tcpsocket/gethostbyname_spec.rb index 703abff81c..c6fe007827 100644 --- a/spec/ruby/library/socket/tcpsocket/gethostbyname_spec.rb +++ b/spec/ruby/library/socket/tcpsocket/gethostbyname_spec.rb @@ -2,13 +2,15 @@ require_relative '../spec_helper' require_relative '../fixtures/classes' # TODO: verify these for windows -describe "TCPSocket#gethostbyname" do +describe "TCPSocket.gethostbyname" do before :each do - @host_info = TCPSocket.gethostbyname(SocketSpecs.hostname) + suppress_warning do + @host_info = TCPSocket.gethostbyname(SocketSpecs.hostname) + end end it "returns an array elements of information on the hostname" do - @host_info.should be_kind_of(Array) + @host_info.should.is_a?(Array) end platform_is_not :windows do @@ -18,12 +20,12 @@ describe "TCPSocket#gethostbyname" do it "returns the address type as the third value" do address_type = @host_info[2] - [Socket::AF_INET, Socket::AF_INET6].include?(address_type).should be_true + [Socket::AF_INET, Socket::AF_INET6].include?(address_type).should == true end it "returns the IP address as the fourth value" do ip = @host_info[3] - ["127.0.0.1", "::1"].include?(ip).should be_true + ["127.0.0.1", "::1"].include?(ip).should == true end end @@ -46,19 +48,23 @@ describe "TCPSocket#gethostbyname" do end it "returns any aliases to the address as second value" do - @host_info[1].should be_kind_of(Array) + @host_info[1].should.is_a?(Array) end end -describe 'TCPSocket#gethostbyname' do +describe 'TCPSocket.gethostbyname' do it 'returns an Array' do - TCPSocket.gethostbyname('127.0.0.1').should be_an_instance_of(Array) + suppress_warning do + TCPSocket.gethostbyname('127.0.0.1').should.instance_of?(Array) + end end describe 'using a hostname' do describe 'the returned Array' do before do - @array = TCPSocket.gethostbyname('127.0.0.1') + suppress_warning do + @array = TCPSocket.gethostbyname('127.0.0.1') + end end it 'includes the canonical name as the 1st value' do @@ -66,11 +72,11 @@ describe 'TCPSocket#gethostbyname' do end it 'includes an array of alternative hostnames as the 2nd value' do - @array[1].should be_an_instance_of(Array) + @array[1].should.instance_of?(Array) end it 'includes the address family as the 3rd value' do - @array[2].should be_kind_of(Integer) + @array[2].should.is_a?(Integer) end it 'includes the IP addresses as all the remaining values' do @@ -88,7 +94,9 @@ describe 'TCPSocket#gethostbyname' do SocketSpecs.each_ip_protocol do |family, ip_address| describe 'the returned Array' do before do - @array = TCPSocket.gethostbyname(ip_address) + suppress_warning do + @array = TCPSocket.gethostbyname(ip_address) + end end it 'includes the IP address as the 1st value' do |
