diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-05 20:39:02 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-05 20:39:02 +0000 |
commit | a140f157b9ccac155197e8e4b08aea8965faa94c (patch) | |
tree | 6e794499382fe0807637d3d3c2e18bc1fc9138dd /spec | |
parent | c46515e42acc74958b6e13c3288b85f8e06920c2 (diff) | |
download | ruby-a140f157b9ccac155197e8e4b08aea8965faa94c.tar.gz |
Guard a few specs which ipv6_available?
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec')
3 files changed, 73 insertions, 67 deletions
diff --git a/spec/ruby/library/socket/addrinfo/ipv6_linklocal_spec.rb b/spec/ruby/library/socket/addrinfo/ipv6_linklocal_spec.rb index fadc612fb7..c9c703058c 100644 --- a/spec/ruby/library/socket/addrinfo/ipv6_linklocal_spec.rb +++ b/spec/ruby/library/socket/addrinfo/ipv6_linklocal_spec.rb @@ -1,18 +1,20 @@ require_relative '../spec_helper' -describe 'Addrinfo#ipv6_linklocal?' do - it 'returns true for a link-local address' do - Addrinfo.ip('fe80::').ipv6_linklocal?.should == true - Addrinfo.ip('fe81::').ipv6_linklocal?.should == true - Addrinfo.ip('fe8f::').ipv6_linklocal?.should == true - Addrinfo.ip('fe80::1').ipv6_linklocal?.should == true - end +guard -> { SocketSpecs.ipv6_available? } do + describe 'Addrinfo#ipv6_linklocal?' do + it 'returns true for a link-local address' do + Addrinfo.ip('fe80::').ipv6_linklocal?.should == true + Addrinfo.ip('fe81::').ipv6_linklocal?.should == true + Addrinfo.ip('fe8f::').ipv6_linklocal?.should == true + Addrinfo.ip('fe80::1').ipv6_linklocal?.should == true + end - it 'returns false for a regular address' do - Addrinfo.ip('::1').ipv6_linklocal?.should == false - end + it 'returns false for a regular address' do + Addrinfo.ip('::1').ipv6_linklocal?.should == false + end - it 'returns false for an IPv4 address' do - Addrinfo.ip('127.0.0.1').ipv6_linklocal?.should == false + it 'returns false for an IPv4 address' do + Addrinfo.ip('127.0.0.1').ipv6_linklocal?.should == false + end end end diff --git a/spec/ruby/library/socket/addrinfo/ipv6_sitelocal_spec.rb b/spec/ruby/library/socket/addrinfo/ipv6_sitelocal_spec.rb index f0c382f00c..14ed6688a1 100644 --- a/spec/ruby/library/socket/addrinfo/ipv6_sitelocal_spec.rb +++ b/spec/ruby/library/socket/addrinfo/ipv6_sitelocal_spec.rb @@ -1,18 +1,20 @@ require_relative '../spec_helper' -describe 'Addrinfo#ipv6_sitelocal?' do - it 'returns true for a site-local address' do - Addrinfo.ip('feef::').ipv6_sitelocal?.should == true - Addrinfo.ip('fee0::').ipv6_sitelocal?.should == true - Addrinfo.ip('fee2::').ipv6_sitelocal?.should == true - Addrinfo.ip('feef::1').ipv6_sitelocal?.should == true - end +guard -> { SocketSpecs.ipv6_available? } do + describe 'Addrinfo#ipv6_sitelocal?' do + it 'returns true for a site-local address' do + Addrinfo.ip('feef::').ipv6_sitelocal?.should == true + Addrinfo.ip('fee0::').ipv6_sitelocal?.should == true + Addrinfo.ip('fee2::').ipv6_sitelocal?.should == true + Addrinfo.ip('feef::1').ipv6_sitelocal?.should == true + end - it 'returns false for a regular IPv6 address' do - Addrinfo.ip('::1').ipv6_sitelocal?.should == false - end + it 'returns false for a regular IPv6 address' do + Addrinfo.ip('::1').ipv6_sitelocal?.should == false + end - it 'returns false for an IPv4 address' do - Addrinfo.ip('127.0.0.1').ipv6_sitelocal?.should == false + it 'returns false for an IPv4 address' do + Addrinfo.ip('127.0.0.1').ipv6_sitelocal?.should == false + end end end diff --git a/spec/ruby/library/socket/addrinfo/ipv6_to_ipv4_spec.rb b/spec/ruby/library/socket/addrinfo/ipv6_to_ipv4_spec.rb index 48c1706459..2f031ddde0 100644 --- a/spec/ruby/library/socket/addrinfo/ipv6_to_ipv4_spec.rb +++ b/spec/ruby/library/socket/addrinfo/ipv6_to_ipv4_spec.rb @@ -1,66 +1,68 @@ require_relative '../spec_helper' -describe 'Addrinfo#ipv6_to_ipv4' do - it 'returns an Addrinfo for ::192.168.1.1' do - addr = Addrinfo.ip('::192.168.1.1').ipv6_to_ipv4 +guard -> { SocketSpecs.ipv6_available? } do + describe 'Addrinfo#ipv6_to_ipv4' do + it 'returns an Addrinfo for ::192.168.1.1' do + addr = Addrinfo.ip('::192.168.1.1').ipv6_to_ipv4 - addr.should be_an_instance_of(Addrinfo) + addr.should be_an_instance_of(Addrinfo) - addr.afamily.should == Socket::AF_INET - addr.ip_address.should == '192.168.1.1' - end + addr.afamily.should == Socket::AF_INET + addr.ip_address.should == '192.168.1.1' + end - it 'returns an Addrinfo for ::0.0.1.1' do - addr = Addrinfo.ip('::0.0.1.1').ipv6_to_ipv4 + it 'returns an Addrinfo for ::0.0.1.1' do + addr = Addrinfo.ip('::0.0.1.1').ipv6_to_ipv4 - addr.should be_an_instance_of(Addrinfo) + addr.should be_an_instance_of(Addrinfo) - addr.afamily.should == Socket::AF_INET - addr.ip_address.should == '0.0.1.1' - end + addr.afamily.should == Socket::AF_INET + addr.ip_address.should == '0.0.1.1' + end - it 'returns an Addrinfo for ::0.0.1.0' do - addr = Addrinfo.ip('::0.0.1.0').ipv6_to_ipv4 + it 'returns an Addrinfo for ::0.0.1.0' do + addr = Addrinfo.ip('::0.0.1.0').ipv6_to_ipv4 - addr.should be_an_instance_of(Addrinfo) + addr.should be_an_instance_of(Addrinfo) - addr.afamily.should == Socket::AF_INET - addr.ip_address.should == '0.0.1.0' - end + addr.afamily.should == Socket::AF_INET + addr.ip_address.should == '0.0.1.0' + end - it 'returns an Addrinfo for ::0.1.0.0' do - addr = Addrinfo.ip('::0.1.0.0').ipv6_to_ipv4 + it 'returns an Addrinfo for ::0.1.0.0' do + addr = Addrinfo.ip('::0.1.0.0').ipv6_to_ipv4 - addr.should be_an_instance_of(Addrinfo) + addr.should be_an_instance_of(Addrinfo) - addr.afamily.should == Socket::AF_INET - addr.ip_address.should == '0.1.0.0' - end + addr.afamily.should == Socket::AF_INET + addr.ip_address.should == '0.1.0.0' + end - it 'returns an Addrinfo for ::ffff:192.168.1.1' do - addr = Addrinfo.ip('::ffff:192.168.1.1').ipv6_to_ipv4 + it 'returns an Addrinfo for ::ffff:192.168.1.1' do + addr = Addrinfo.ip('::ffff:192.168.1.1').ipv6_to_ipv4 - addr.should be_an_instance_of(Addrinfo) + addr.should be_an_instance_of(Addrinfo) - addr.afamily.should == Socket::AF_INET - addr.ip_address.should == '192.168.1.1' - end + addr.afamily.should == Socket::AF_INET + addr.ip_address.should == '192.168.1.1' + end - it 'returns nil for ::0.0.0.1' do - Addrinfo.ip('::0.0.0.1').ipv6_to_ipv4.should be_nil - end + it 'returns nil for ::0.0.0.1' do + Addrinfo.ip('::0.0.0.1').ipv6_to_ipv4.should be_nil + end - it 'returns nil for a pure IPv6 Addrinfo' do - Addrinfo.ip('::1').ipv6_to_ipv4.should be_nil - end + it 'returns nil for a pure IPv6 Addrinfo' do + Addrinfo.ip('::1').ipv6_to_ipv4.should be_nil + end - it 'returns nil for an IPv4 Addrinfo' do - Addrinfo.ip('192.168.1.1').ipv6_to_ipv4.should be_nil - end + it 'returns nil for an IPv4 Addrinfo' do + Addrinfo.ip('192.168.1.1').ipv6_to_ipv4.should be_nil + end - with_feature :unix_socket do - it 'returns nil for a UNIX Addrinfo' do - Addrinfo.unix('foo').ipv6_to_ipv4.should be_nil + with_feature :unix_socket do + it 'returns nil for a UNIX Addrinfo' do + Addrinfo.unix('foo').ipv6_to_ipv4.should be_nil + end end end end |