4 it { is_expected.not_to eq(nil) }
6 describe 'before Puppet 6.0.0', :if => Puppet::Util::Package.versioncmp(Puppet.version, '6.0.0') < 0 do
7 it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
8 it { is_expected.to run.with_params('one', 'two').and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
11 describe 'from Puppet 6.0.0', :if => Puppet::Util::Package.versioncmp(Puppet.version, '6.0.0') >= 0 do
12 it { is_expected.to run.with_params.and_raise_error(ArgumentError, %r{expects between 1 and 2 arguments, got none}i) }
13 it { is_expected.to run.with_params('one', 'two').and_return('two') }
14 it { is_expected.to run.with_params('one', 'two', 'three').and_raise_error(ArgumentError, %r{expects between 1 and 2 arguments, got 3}i) }
17 it { is_expected.to run.with_params('::foo').and_return(nil) }
19 context 'with given variables in namespaces' do
20 let(:pre_condition) do
22 class site::data { $foo = 'baz' }
27 it { is_expected.to run.with_params('site::data::foo').and_return('baz') }
28 it { is_expected.to run.with_params('::site::data::foo').and_return('baz') }
29 it { is_expected.to run.with_params('::site::data::bar').and_return(nil) }
32 context 'with given variables in namespaces' do
33 let(:pre_condition) do
35 class site::info { $lock = 'ŧҺîš íš ắ śţřĭŋĝ' }
36 class site::new { $item = '万Ü€‰' }
42 it { is_expected.to run.with_params('site::info::lock').and_return('ŧҺîš íš ắ śţřĭŋĝ') }
43 it { is_expected.to run.with_params('::site::new::item').and_return('万Ü€‰') }