summaryrefslogtreecommitdiff
path: root/spec/ruby/library
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-08-29 11:58:05 +0200
committerBenoit Daloze <eregontp@gmail.com>2020-08-29 11:58:56 +0200
commit1199f1a4aac3946cb427f2bed73948b02ee14a74 (patch)
tree3198cbd9e7fcf52b2790cebb8d6bc9a5f4479e04 /spec/ruby/library
parent232d6c4077ab254b13ef006dd1e7e7c1d46a6cd3 (diff)
Fix warnings related to new Socket.gethostby* deprecations
Diffstat (limited to 'spec/ruby/library')
-rw-r--r--spec/ruby/library/socket/socket/gethostbyaddr_spec.rb20
-rw-r--r--spec/ruby/library/socket/socket/gethostbyname_spec.rb16
2 files changed, 18 insertions, 18 deletions
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 '<broadcast>'" do
- addr = Socket.gethostbyname('<broadcast>');
+ addr = suppress_warning { Socket.gethostbyname('<broadcast>') }
addr.should == ["255.255.255.255", [], 2, "\xFF\xFF\xFF\xFF"]
end
it "returns broadcast address info for '<any>'" do
- addr = Socket.gethostbyname('<any>');
+ addr = suppress_warning { Socket.gethostbyname('<any>') }
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 <broadcast> as the input address' do
describe 'the returned Array' do
before do
- @addr = Socket.gethostbyname('<broadcast>')
+ @addr = suppress_warning { Socket.gethostbyname('<broadcast>') }
end
it 'includes the broadcast address as the first value' do
@@ -74,7 +74,7 @@ describe 'Socket.gethostbyname' do
describe 'using <any> as the input address' do
describe 'the returned Array' do
before do
- @addr = Socket.gethostbyname('<any>')
+ @addr = suppress_warning { Socket.gethostbyname('<any>') }
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