From 128d6fe56855ba37698f67314b991a2bfdb7af37 Mon Sep 17 00:00:00 2001 From: Helen Campbell Date: Thu, 12 Jan 2017 15:35:35 +0000 Subject: Addition of compat hash type for deprecation --- spec/aliases/hash_spec.rb | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 spec/aliases/hash_spec.rb (limited to 'spec/aliases/hash_spec.rb') diff --git a/spec/aliases/hash_spec.rb b/spec/aliases/hash_spec.rb new file mode 100644 index 0000000..e10a04b --- /dev/null +++ b/spec/aliases/hash_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +if Puppet.version.to_f >= 4.5 + describe 'test::hash', type: :class do + describe 'accepts hashes' do + [ + {}, + {'one' => "two"}, + {'wan' => 3}, + {'001' => "helly"}, + ].each do |value| + describe value.inspect do + let(:params) {{ value: value }} + it { is_expected.to compile } + end + end + end + describe 'rejects other values' do + [ + '', + 'one', + '1', + [], + ].each do |value| + describe value.inspect do + let(:params) {{ value: value }} + it { is_expected.to compile.and_raise_error(/parameter 'value' expects a Stdlib::Compat::Hash/) } + end + end + end + end +end -- cgit v1.2.3 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/hash_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/aliases/hash_spec.rb') diff --git a/spec/aliases/hash_spec.rb b/spec/aliases/hash_spec.rb index e10a04b..6e5060d 100644 --- a/spec/aliases/hash_spec.rb +++ b/spec/aliases/hash_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::hash', type: :class do describe 'accepts hashes' do [ -- cgit v1.2.3