3 describe 'validate_array' do
4 describe 'signature validation' do
6 ENV.delete('STDLIB_LOG_DEPRECATIONS')
8 it { is_expected.not_to eq(nil) }
9 # Checking for deprecation warning
10 it 'displays a single deprecation' do
11 ENV['STDLIB_LOG_DEPRECATIONS'] = 'true'
12 expect(scope).to receive(:warning).with(include('This method is deprecated'))
13 is_expected.to run.with_params([])
15 it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
17 describe 'valid inputs' do
18 it { is_expected.to run.with_params([]) }
19 it { is_expected.to run.with_params(['one']) }
20 it { is_expected.to run.with_params([], ['two']) }
21 it { is_expected.to run.with_params(['one'], ['two']) }
24 describe 'invalid inputs' do
25 it { is_expected.to run.with_params({}).and_raise_error(Puppet::ParseError, %r{is not an Array}) }
26 it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, %r{is not an Array}) }
27 it { is_expected.to run.with_params(true).and_raise_error(Puppet::ParseError, %r{is not an Array}) }
28 it { is_expected.to run.with_params('one').and_raise_error(Puppet::ParseError, %r{is not an Array}) }
29 it { is_expected.to run.with_params([], {}).and_raise_error(Puppet::ParseError, %r{is not an Array}) }
30 it { is_expected.to run.with_params([], 1).and_raise_error(Puppet::ParseError, %r{is not an Array}) }
31 it { is_expected.to run.with_params([], true).and_raise_error(Puppet::ParseError, %r{is not an Array}) }
32 it { is_expected.to run.with_params([], 'one').and_raise_error(Puppet::ParseError, %r{is not an Array}) }
33 it { is_expected.to run.with_params(nil).and_raise_error(Puppet::ParseError, %r{is not an Array}) }