diff options
author | Dominic Cleal <dominic@cleal.org> | 2017-03-14 11:16:07 +0000 |
---|---|---|
committer | Dominic Cleal <dominic@cleal.org> | 2017-03-14 11:27:42 +0000 |
commit | 318dcfaec6ba6d0e4af1e32e55ea20b721679537 (patch) | |
tree | c694e92cbf56620acd5fdaf85d2b4a83ca6db9f9 /spec/functions/ensure_resource_spec.rb | |
parent | e4ea1c46e7408f6878819dc08905be445a9c7bc8 (diff) |
(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.
Diffstat (limited to 'spec/functions/ensure_resource_spec.rb')
-rwxr-xr-x | spec/functions/ensure_resource_spec.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/functions/ensure_resource_spec.rb b/spec/functions/ensure_resource_spec.rb index fddc4c4..5366205 100755 --- a/spec/functions/ensure_resource_spec.rb +++ b/spec/functions/ensure_resource_spec.rb @@ -4,7 +4,7 @@ describe 'ensure_resource' do it { is_expected.not_to eq(nil) } it { is_expected.to run.with_params().and_raise_error(ArgumentError, /Must specify a type/) } it { is_expected.to run.with_params('type').and_raise_error(ArgumentError, /Must specify a title/) } - if Puppet.version.to_f >= 4.6 + if Puppet::Util::Package.versioncmp(Puppet.version, '4.6.0') >= 0 it { is_expected.to run.with_params('type', 'title', {}, 'extras').and_raise_error(ArgumentError) } else it { is_expected.to run.with_params('type', 'title', {}, 'extras').and_raise_error(Puppet::ParseError) } |