4 describe 'signature validation' do
5 it { is_expected.not_to eq(nil) }
6 it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
7 it { is_expected.to run.with_params([], 'extra').and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
8 it { pending('stricter input checking'); is_expected.to run.with_params({}).and_raise_error(Puppet::ParseError, /requires string or array/) }
9 it { pending('stricter input checking'); is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError, /requires string or array/) }
10 it { pending('stricter input checking'); is_expected.to run.with_params(true).and_raise_error(Puppet::ParseError, /requires string or array/) }
13 context 'when called with an array' do
14 it { is_expected.to run.with_params([]).and_return([]) }
15 it { is_expected.to run.with_params(['a']).and_return(['a']) }
16 it { is_expected.to run.with_params(['c', 'b', 'a']).and_return(['a', 'b', 'c']) }
19 context 'when called with a string' do
20 it { is_expected.to run.with_params('').and_return('') }
21 it { is_expected.to run.with_params('a').and_return('a') }
22 it { is_expected.to run.with_params('cbda').and_return('abcd') }