3 describe 'is_ipv6_address' do
4 it { is_expected.not_to eq(nil) }
5 it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
6 it { is_expected.to run.with_params('2001:0db8:85a3:0000:0000:8a2e:0370:7334').and_return(true) }
7 it { is_expected.to run.with_params('85a3:0000:0000:8a2e:0370:7334:100.100.100.100').and_return(true) }
8 it { is_expected.to run.with_params('1.2.3').and_return(false) }
9 it { is_expected.to run.with_params('1.2.3.4.5').and_return(false) }
10 it { is_expected.to run.with_params('').and_return(false) }
11 it { is_expected.to run.with_params('one').and_return(false) }
13 context 'Checking for deprecation warning', :if => Puppet.version.to_f < 4.0 do
15 ENV.delete('STDLIB_LOG_DEPRECATIONS')
17 # Checking for deprecation warning, which should only be provoked when the env variable for it is set.
18 it 'displays a single deprecation' do
19 ENV['STDLIB_LOG_DEPRECATIONS'] = 'true'
20 expect(scope).to receive(:warning).with(include('This method is deprecated'))
21 is_expected.to run.with_params('2001:0db8:85a3:0000:0000:8a2e:0370:7334').and_return(true)
23 it 'displays no warning for deprecation' do
24 ENV['STDLIB_LOG_DEPRECATIONS'] = 'false'
25 expect(scope).to receive(:warning).with(include('This method is deprecated')).never
26 is_expected.to run.with_params('2001:0db8:85a3:0000:0000:8a2e:0370:7334').and_return(true)