37
|
1 require 'spec_helper'
|
|
2
|
272
|
3 describe 'is_array' 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 {
|
|
7 pending('Current implementation ignores parameters after the first.')
|
|
8 is_expected.to run.with_params([], []).and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i)
|
|
9 }
|
|
10 it { is_expected.to run.with_params([]).and_return(true) }
|
|
11 it { is_expected.to run.with_params(['one']).and_return(true) }
|
|
12 it { is_expected.to run.with_params([1]).and_return(true) }
|
|
13 it { is_expected.to run.with_params([{}]).and_return(true) }
|
|
14 it { is_expected.to run.with_params([[]]).and_return(true) }
|
|
15 it { is_expected.to run.with_params('').and_return(false) }
|
|
16 it { is_expected.to run.with_params('one').and_return(false) }
|
|
17 it { is_expected.to run.with_params(1).and_return(false) }
|
|
18 it { is_expected.to run.with_params({}).and_return(false) }
|
|
19 context 'with deprecation warning' do
|
|
20 after(:each) do
|
|
21 ENV.delete('STDLIB_LOG_DEPRECATIONS')
|
|
22 end
|
|
23 # Checking for deprecation warning, which should only be provoked when the env variable for it is set.
|
|
24 it 'displays a single deprecation' do
|
|
25 ENV['STDLIB_LOG_DEPRECATIONS'] = 'true'
|
|
26 scope.expects(:warning).with(includes('This method is deprecated'))
|
|
27 is_expected.to run.with_params(['1.2.3.4']).and_return(true)
|
|
28 end
|
|
29 it 'displays no warning for deprecation' do
|
|
30 ENV['STDLIB_LOG_DEPRECATIONS'] = 'false'
|
|
31 scope.expects(:warning).with(includes('This method is deprecated')).never
|
|
32 is_expected.to run.with_params(['1.2.3.4']).and_return(true)
|
|
33 end
|
37
|
34 end
|
|
35 end
|