3 describe 'is_ipv4_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) }
7 SharedData::IPV4_PATTERNS.each do |value|
8 it { is_expected.to run.with_params(value).and_return(true) }
11 SharedData::IPV4_NEGATIVE_PATTERNS.each do |value|
12 it { is_expected.to run.with_params(value).and_return(false) }
15 context 'Checking for deprecation warning', :if => Puppet.version.to_f < 4.0 do
17 ENV.delete('STDLIB_LOG_DEPRECATIONS')
19 # Checking for deprecation warning, which should only be provoked when the env variable for it is set.
20 it 'displays a single deprecation' do
21 ENV['STDLIB_LOG_DEPRECATIONS'] = 'true'
22 expect(scope).to receive(:warning).with(include('This method is deprecated'))
23 is_expected.to run.with_params(SharedData::IPV4_PATTERNS.first).and_return(true)
25 it 'displays no warning for deprecation' do
26 ENV['STDLIB_LOG_DEPRECATIONS'] = 'false'
27 expect(scope).to receive(:warning).with(include('This method is deprecated')).never
28 is_expected.to run.with_params(SharedData::IPV4_PATTERNS.first).and_return(true)