diff --git a/spec/ruby/library/socket/socket/gethostbyaddr_spec.rb b/spec/ruby/library/socket/socket/gethostbyaddr_spec.rb index 8bebeb0e21..a4c8355520 100644 --- a/spec/ruby/library/socket/socket/gethostbyaddr_spec.rb +++ b/spec/ruby/library/socket/socket/gethostbyaddr_spec.rb @@ -10,12 +10,12 @@ describe 'Socket.gethostbyaddr' do describe 'without an explicit address family' do it 'returns an Array' do - Socket.gethostbyaddr(@addr).should be_an_instance_of(Array) + suppress_warning { Socket.gethostbyaddr(@addr) }.should be_an_instance_of(Array) end describe 'the returned Array' do before do - @array = Socket.gethostbyaddr(@addr) + @array = suppress_warning { Socket.gethostbyaddr(@addr) } end # RubyCI Solaris 11x defines 127.0.0.1 as unstable11x @@ -49,15 +49,15 @@ describe 'Socket.gethostbyaddr' do describe 'with an explicit address family' do it 'returns an Array when using an Integer as the address family' do - Socket.gethostbyaddr(@addr, Socket::AF_INET).should be_an_instance_of(Array) + suppress_warning { Socket.gethostbyaddr(@addr, Socket::AF_INET) }.should be_an_instance_of(Array) end it 'returns an Array when using a Symbol as the address family' do - Socket.gethostbyaddr(@addr, :INET).should be_an_instance_of(Array) + suppress_warning { Socket.gethostbyaddr(@addr, :INET) }.should be_an_instance_of(Array) end it 'raises SocketError when the address is not supported by the family' do - -> { Socket.gethostbyaddr(@addr, :INET6) }.should raise_error(SocketError) + -> { suppress_warning { Socket.gethostbyaddr(@addr, :INET6) } }.should raise_error(SocketError) end end end @@ -70,12 +70,12 @@ describe 'Socket.gethostbyaddr' do describe 'without an explicit address family' do it 'returns an Array' do - Socket.gethostbyaddr(@addr).should be_an_instance_of(Array) + suppress_warning { Socket.gethostbyaddr(@addr) }.should be_an_instance_of(Array) end describe 'the returned Array' do before do - @array = Socket.gethostbyaddr(@addr) + @array = suppress_warning { Socket.gethostbyaddr(@addr) } end it 'includes the hostname as the first value' do @@ -106,16 +106,16 @@ describe 'Socket.gethostbyaddr' do describe 'with an explicit address family' do it 'returns an Array when using an Integer as the address family' do - Socket.gethostbyaddr(@addr, Socket::AF_INET6).should be_an_instance_of(Array) + suppress_warning { Socket.gethostbyaddr(@addr, Socket::AF_INET6) }.should be_an_instance_of(Array) end it 'returns an Array when using a Symbol as the address family' do - Socket.gethostbyaddr(@addr, :INET6).should be_an_instance_of(Array) + suppress_warning { Socket.gethostbyaddr(@addr, :INET6) }.should be_an_instance_of(Array) end platform_is_not :windows, :wsl do it 'raises SocketError when the address is not supported by the family' do - -> { Socket.gethostbyaddr(@addr, :INET) }.should raise_error(SocketError) + -> { suppress_warning { Socket.gethostbyaddr(@addr, :INET) } }.should raise_error(SocketError) end end end diff --git a/spec/ruby/library/socket/socket/gethostbyname_spec.rb b/spec/ruby/library/socket/socket/gethostbyname_spec.rb index 2696f44566..0858e255e4 100644 --- a/spec/ruby/library/socket/socket/gethostbyname_spec.rb +++ b/spec/ruby/library/socket/socket/gethostbyname_spec.rb @@ -4,24 +4,24 @@ require_relative '../fixtures/classes' describe "Socket.gethostbyname" do it "returns broadcast address info for ''" do - addr = Socket.gethostbyname(''); + addr = suppress_warning { Socket.gethostbyname('') } addr.should == ["255.255.255.255", [], 2, "\xFF\xFF\xFF\xFF"] end it "returns broadcast address info for ''" do - addr = Socket.gethostbyname(''); + addr = suppress_warning { Socket.gethostbyname('') } addr.should == ["0.0.0.0", [], 2, "\x00\x00\x00\x00"] end end describe 'Socket.gethostbyname' do it 'returns an Array' do - Socket.gethostbyname('127.0.0.1').should be_an_instance_of(Array) + suppress_warning { Socket.gethostbyname('127.0.0.1') }.should be_an_instance_of(Array) end describe 'the returned Array' do before do - @array = Socket.gethostbyname('127.0.0.1') + @array = suppress_warning { Socket.gethostbyname('127.0.0.1') } end it 'includes the hostname as the first value' do @@ -54,7 +54,7 @@ describe 'Socket.gethostbyname' do describe 'using as the input address' do describe 'the returned Array' do before do - @addr = Socket.gethostbyname('') + @addr = suppress_warning { Socket.gethostbyname('') } end it 'includes the broadcast address as the first value' do @@ -74,7 +74,7 @@ describe 'Socket.gethostbyname' do describe 'using as the input address' do describe 'the returned Array' do before do - @addr = Socket.gethostbyname('') + @addr = suppress_warning { Socket.gethostbyname('') } end it 'includes the wildcard address as the first value' do @@ -94,7 +94,7 @@ describe 'Socket.gethostbyname' do describe 'using an IPv4 address' do describe 'the returned Array' do before do - @addr = Socket.gethostbyname('127.0.0.1') + @addr = suppress_warning { Socket.gethostbyname('127.0.0.1') } end it 'includes the IP address as the first value' do @@ -115,7 +115,7 @@ describe 'Socket.gethostbyname' do describe 'using an IPv6 address' do describe 'the returned Array' do before do - @addr = Socket.gethostbyname('::1') + @addr = suppress_warning { Socket.gethostbyname('::1') } end it 'includes the IP address as the first value' do