From 318dcfaec6ba6d0e4af1e32e55ea20b721679537 Mon Sep 17 00:00:00 2001 From: Dominic Cleal Date: Tue, 14 Mar 2017 11:16:07 +0000 Subject: (MODULES-4528) Use versioncmp to check Puppet version for 4.10.x compat `Puppet.version.to_f` on Puppet 4.10.0 will evaluate to `4.1`, causing test and behavioural changes when conditionals check that the version is equal or greater than versions such as `4.3`. Version comparisons that are vulnerable to this have been changed to use Puppet's versioncmp implementation, while most others only check for for major version boundaries which is safe. --- spec/aliases/float_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/aliases/float_spec.rb') diff --git a/spec/aliases/float_spec.rb b/spec/aliases/float_spec.rb index cc20758..66079c6 100644 --- a/spec/aliases/float_spec.rb +++ b/spec/aliases/float_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -if Puppet.version.to_f >= 4.5 +if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 describe 'test::float', type: :class do describe 'accepts floats' do [ -- cgit v1.2.3 From 33922a4ec7a8c204a17e0c3017eea21faa220f39 Mon Sep 17 00:00:00 2001 From: tphoney Date: Fri, 14 Jul 2017 10:14:04 +0100 Subject: FM-6239 clean up for puppet 5.tests/deprecation --- spec/aliases/float_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/aliases/float_spec.rb') diff --git a/spec/aliases/float_spec.rb b/spec/aliases/float_spec.rb index 66079c6..84e1934 100644 --- a/spec/aliases/float_spec.rb +++ b/spec/aliases/float_spec.rb @@ -20,7 +20,7 @@ if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 [ true, 'true', false, 'false', 'iAmAString', '1test', '1 test', 'test 1', 'test 1 test', {}, { 'key' => 'value' }, { 1=> 2 }, '', :undef , 'x', 3, '3', -3, '-3'].each do |value| describe value.inspect do let(:params) {{ value: value }} - it { is_expected.to compile.and_raise_error(/parameter 'value' expects a value of type Float or Pattern(\[.*\]+)?/) } + it { is_expected.to compile.and_raise_error(/parameter 'value' expects.*Float.*Pattern/) } end end end -- cgit v1.2.3