From 3405ea62b5989281a4ddfa4f64db9e6a8624a500 Mon Sep 17 00:00:00 2001 From: eregon Date: Sat, 18 Aug 2018 19:35:37 +0000 Subject: Accept TypeError for Socket#getnameinfo * Happens when VALIDATE_SOCKLEN() actually checks the length such as on FreeBSD. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- spec/ruby/library/socket/socket/getnameinfo_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'spec/ruby') diff --git a/spec/ruby/library/socket/socket/getnameinfo_spec.rb b/spec/ruby/library/socket/socket/getnameinfo_spec.rb index 394a90cb47..d5511ad499 100644 --- a/spec/ruby/library/socket/socket/getnameinfo_spec.rb +++ b/spec/ruby/library/socket/socket/getnameinfo_spec.rb @@ -68,8 +68,10 @@ describe 'Socket.getnameinfo' do @addr = Socket.sockaddr_in(80, '127.0.0.1') end - it 'raises SocketError when using an invalid String' do - lambda { Socket.getnameinfo('cats') }.should raise_error(SocketError) + it 'raises SocketError or TypeError when using an invalid String' do + lambda { Socket.getnameinfo('cats') }.should raise_error(Exception) { |e| + [SocketError, TypeError].should include(e.class) + } end describe 'without custom flags' do -- cgit v1.2.3