3 describe 'validate_array' do
5 describe 'signature validation' do
7 ENV.delete('STDLIB_LOG_DEPRECATIONS')
9 it { is_expected.not_to eq(nil) }
10 # Checking for deprecation warning
11 it 'should display a single deprecation' do
12 ENV['STDLIB_LOG_DEPRECATIONS'] = "true"
13 scope.expects(:warning).with(includes('This method is deprecated'))
14 is_expected.to run.with_params([])
16 it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
18 describe 'valid inputs' do
19 it { is_expected.to run.with_params([]) }
20 it { is_expected.to run.with_params(['one']) }
21 it { is_expected.to run.with_params([], ['two']) }
22 it { is_expected.to run.with_params(['one'], ['two']) }
25 describe 'invalid inputs' do
26 it { is_expected.to run.with_params({}).and_raise_error(Puppet::ParseError, /is not an Array/) }
27 it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, /is not an Array/) }
28 it { is_expected.to run.with_params(true).and_raise_error(Puppet::ParseError, /is not an Array/) }
29 it { is_expected.to run.with_params('one').and_raise_error(Puppet::ParseError, /is not an Array/) }
30 it { is_expected.to run.with_params([], {}).and_raise_error(Puppet::ParseError, /is not an Array/) }
31 it { is_expected.to run.with_params([], 1).and_raise_error(Puppet::ParseError, /is not an Array/) }
32 it { is_expected.to run.with_params([], true).and_raise_error(Puppet::ParseError, /is not an Array/) }
33 it { is_expected.to run.with_params([], 'one').and_raise_error(Puppet::ParseError, /is not an Array/) }