summaryrefslogtreecommitdiff
path: root/spec/ruby/library/socket/udpsocket/initialize_spec.rb
diff options
context:
space:
mode:
authorJeremy Evans <[email protected]>2019-06-06 21:10:21 -0700
committerJeremy Evans <[email protected]>2019-06-06 21:16:28 -0700
commit119ca4343cceed031f017ce2e0d2a1e709344a0f (patch)
tree0bb7ff9f03226ca3959ef039ae72cb86c6f329fe /spec/ruby/library/socket/udpsocket/initialize_spec.rb
parentc55de95ff1c4ea6313c2863037703a0e5f0d0f4f (diff)
Make specs pass on OpenBSD
Skip Process clockres specs that don't work on either FreeBSD or Solaris/AIX in addition to OpenBSD. Run most current String#crypt specs on non-OpenBSD, and add a new set of crypt specs for OpenBSD, which support bcrypt but not DES in crypt(3). Use @server.connect_address instead of @server.getsockname in some socket tests, as OpenBSD does not treat connection to all zero IPv4 or IPv6 addresses as connection to localhost. When trying to connect using UDP on an unsupported address family, allow Errno::EPROTONOSUPPORT in addition to Errno::EAFNOSUPPORT, as OpenBSD raises the former.
Diffstat (limited to 'spec/ruby/library/socket/udpsocket/initialize_spec.rb')
-rw-r--r--spec/ruby/library/socket/udpsocket/initialize_spec.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/ruby/library/socket/udpsocket/initialize_spec.rb b/spec/ruby/library/socket/udpsocket/initialize_spec.rb
index 06f7b5ef1c..9497d0dcbc 100644
--- a/spec/ruby/library/socket/udpsocket/initialize_spec.rb
+++ b/spec/ruby/library/socket/udpsocket/initialize_spec.rb
@@ -30,7 +30,13 @@ describe 'UDPSocket#initialize' do
@socket.binmode?.should be_true
end
- it 'raises Errno::EAFNOSUPPORT when given an invalid address family' do
- lambda { UDPSocket.new(666) }.should raise_error(Errno::EAFNOSUPPORT)
+ it 'raises Errno::EAFNOSUPPORT or Errno::EPROTONOSUPPORT when given an invalid address family' do
+ begin
+ UDPSocket.new(666)
+ rescue Errno::EAFNOSUPPORT, Errno::EPROTONOSUPPORT => e
+ [Errno::EAFNOSUPPORT, Errno::EPROTONOSUPPORT].should include(e.class)
+ else
+ raise "expected Errno::EAFNOSUPPORT or Errno::EPROTONOSUPPORT exception raised"
+ end
end
end