4 it { is_expected.not_to eq(nil) }
6 it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
7 it { is_expected.to run.with_params(0.1, 0.2).and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
8 it { is_expected.to run.with_params('0.1').and_return(true) }
9 it { is_expected.to run.with_params('1.0').and_return(true) }
10 it { is_expected.to run.with_params('1').and_return(false) }
11 it { is_expected.to run.with_params('one').and_return(false) }
12 it { is_expected.to run.with_params('one 1.0').and_return(false) }
13 it { is_expected.to run.with_params('1.0 one').and_return(false) }
14 it { is_expected.to run.with_params(0.1).and_return(true) }
15 it { is_expected.to run.with_params(1.0).and_return(true) }
16 it { is_expected.to run.with_params(1).and_return(false) }
17 it { is_expected.to run.with_params({}).and_return(false) }
18 it { is_expected.to run.with_params([]).and_return(false) }
20 context 'with deprecation warning' do
22 ENV.delete('STDLIB_LOG_DEPRECATIONS')
24 # Checking for deprecation warning, which should only be provoked when the env variable for it is set.
25 it 'displays a single deprecation' do
26 ENV['STDLIB_LOG_DEPRECATIONS'] = 'true'
27 expect(scope).to receive(:warning).with(include('This method is deprecated'))
28 is_expected.to run.with_params(2.2).and_return(true)
30 it 'displays no warning for deprecation' do
31 ENV['STDLIB_LOG_DEPRECATIONS'] = 'false'
32 expect(scope).to receive(:warning).with(include('This method is deprecated')).never
33 is_expected.to run.with_params(1.0).and_return(true)