summaryrefslogtreecommitdiff
path: root/spec/ruby/library/socket/spec_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/socket/spec_helper.rb')
-rw-r--r--spec/ruby/library/socket/spec_helper.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/ruby/library/socket/spec_helper.rb b/spec/ruby/library/socket/spec_helper.rb
new file mode 100644
index 0000000000..86f3a61086
--- /dev/null
+++ b/spec/ruby/library/socket/spec_helper.rb
@@ -0,0 +1,14 @@
+require_relative '../../spec_helper'
+require 'socket'
+
+# We force enable all features on Linux because anyway Linux implements all these features,
+# and we want a constant number of spec examples across Ruby implementations, even if they don't define these constants.
+MSpec.enable_feature :sock_packet if platform_is(:linux) || Socket.const_defined?(:SOCK_PACKET)
+MSpec.enable_feature :udp_cork if platform_is(:linux) || Socket.const_defined?(:UDP_CORK)
+MSpec.enable_feature :tcp_cork if platform_is(:linux) || Socket.const_defined?(:TCP_CORK)
+MSpec.enable_feature :pktinfo if platform_is(:linux) || Socket.const_defined?(:IP_PKTINFO)
+MSpec.enable_feature :ipv6_pktinfo if platform_is(:linux) || Socket.const_defined?(:IPV6_PKTINFO)
+MSpec.enable_feature :ip_mtu if platform_is(:linux) || Socket.const_defined?(:IP_MTU)
+MSpec.enable_feature :ipv6_nexthop if platform_is(:linux) || Socket.const_defined?(:IPV6_NEXTHOP)
+MSpec.enable_feature :tcp_info if platform_is(:linux) || Socket.const_defined?(:TCP_INFO)
+MSpec.enable_feature :ancillary_data if platform_is(:linux) || Socket.const_defined?(:AncillaryData)