summaryrefslogtreecommitdiff
path: root/spec/ruby/library/socket/basicsocket/setsockopt_spec.rb
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-13 05:18:49 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-13 05:18:49 +0000
commit54ad3167e8b34af03c3382174ec21e00124d6b4d (patch)
treeecc753002cf6dc817b5b241b11b1c164bbcc222b /spec/ruby/library/socket/basicsocket/setsockopt_spec.rb
parentd7c806c079bbc3f62476f751ba932732092b8f46 (diff)
tests: support Linux kernels with CONFIG_IPV6=n
Detecting the presence of constants in C headers is insufficient, as a Linux kernel can be built with CONFIG_IPV6=n git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/library/socket/basicsocket/setsockopt_spec.rb')
-rw-r--r--spec/ruby/library/socket/basicsocket/setsockopt_spec.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/spec/ruby/library/socket/basicsocket/setsockopt_spec.rb b/spec/ruby/library/socket/basicsocket/setsockopt_spec.rb
index cafcfc202a..1471b03798 100644
--- a/spec/ruby/library/socket/basicsocket/setsockopt_spec.rb
+++ b/spec/ruby/library/socket/basicsocket/setsockopt_spec.rb
@@ -237,13 +237,15 @@ describe 'BasicSocket#setsockopt' do
@socket.getsockopt(:IP, :TTL).int.should == 255
end
- it 'sets an IPv6 boolean option' do
- socket = Socket.new(:INET6, :STREAM)
- begin
- socket.setsockopt(:IPV6, :V6ONLY, true).should == 0
- socket.getsockopt(:IPV6, :V6ONLY).bool.should == true
- ensure
- socket.close
+ guard -> { SocketSpecs.ipv6_available? } do
+ it 'sets an IPv6 boolean option' do
+ socket = Socket.new(:INET6, :STREAM)
+ begin
+ socket.setsockopt(:IPV6, :V6ONLY, true).should == 0
+ socket.getsockopt(:IPV6, :V6ONLY).bool.should == true
+ ensure
+ socket.close
+ end
end
end