2018-08-03 12:19:40 -04:00
|
|
|
require_relative '../spec_helper'
|
2018-09-09 04:50:53 -04:00
|
|
|
require_relative '../fixtures/classes'
|
2018-08-03 12:19:40 -04:00
|
|
|
|
2018-09-05 16:39:02 -04:00
|
|
|
guard -> { SocketSpecs.ipv6_available? } do
|
|
|
|
describe 'Addrinfo#ipv6_sitelocal?' do
|
2018-09-05 16:39:19 -04:00
|
|
|
platform_is_not :aix do
|
|
|
|
it 'returns true for a site-local address' do
|
2020-05-03 06:28:29 -04:00
|
|
|
Addrinfo.ip('feef::').should.ipv6_sitelocal?
|
|
|
|
Addrinfo.ip('fee0::').should.ipv6_sitelocal?
|
|
|
|
Addrinfo.ip('fee2::').should.ipv6_sitelocal?
|
|
|
|
Addrinfo.ip('feef::1').should.ipv6_sitelocal?
|
2018-09-05 16:39:19 -04:00
|
|
|
end
|
2018-09-05 16:39:02 -04:00
|
|
|
end
|
2018-08-03 12:19:40 -04:00
|
|
|
|
2018-09-05 16:39:02 -04:00
|
|
|
it 'returns false for a regular IPv6 address' do
|
2020-05-03 06:28:29 -04:00
|
|
|
Addrinfo.ip('::1').should_not.ipv6_sitelocal?
|
2018-09-05 16:39:02 -04:00
|
|
|
end
|
2018-08-03 12:19:40 -04:00
|
|
|
|
2018-09-05 16:39:02 -04:00
|
|
|
it 'returns false for an IPv4 address' do
|
2020-05-03 06:28:29 -04:00
|
|
|
Addrinfo.ip('127.0.0.1').should_not.ipv6_sitelocal?
|
2018-09-05 16:39:02 -04:00
|
|
|
end
|
2018-08-03 12:19:40 -04:00
|
|
|
end
|
|
|
|
end
|