3 if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0
4 describe 'test::integer', type: :class do
5 describe 'accepts integers' do
14 describe value.inspect do
15 let(:params) {{ value: value }}
16 it { is_expected.to compile }
21 describe 'rejects other values' do
22 [ "foo\nbar", true, 'true', false, 'false', 'iAmAString', '1test', '1 test', 'test 1', 'test 1 test', {}, { 'key' => 'value' }, { 1=> 2 }, '', :undef , 'x', 3.7, '3.7',-3.7, '-342.2315e-12' ].each do |value|
23 describe value.inspect do
24 let(:params) {{ value: value }}
25 if Puppet::Util::Package.versioncmp(Puppet.version, '5.0.0') >= 0
26 it { is_expected.to compile.and_raise_error(/parameter 'value' expects a Stdlib::Compat::Integer = Variant\[Integer, Pattern\[.*\], Array\[.*\]\] value/) }
28 it { is_expected.to compile.and_raise_error(/parameter 'value' expects a value of type Integer, Pattern(\[.*\]+)?, or Array/) }