summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHailee Kenney <hailee@puppetlabs.com>2016-12-09 13:17:48 +0000
committerHailee Kenney <hailee@puppetlabs.com>2016-12-09 13:48:01 +0000
commit3312cc1f44d1acf25ce45701a74cecd647c50858 (patch)
tree3f026b1eb3bb7747d2742f78d6399f917f944d7e /spec
parent903d94e10527df8a288138d223e07f816422fa2c (diff)
(MODULES-3829) Make ensure_packages work with < 2.0
Prior to this commit, if a hash was passed in as an argument to the ensure_packages function a method of hash duplication would be used that is not supported with versions of ruby older than 2.0. In order to ensure the method is compatible with older ruby versions, switch to a different method of duplication. Additionally add tests to prevent further regressions.
Diffstat (limited to 'spec')
-rwxr-xr-xspec/functions/ensure_packages_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/functions/ensure_packages_spec.rb b/spec/functions/ensure_packages_spec.rb
index c824732..5d97684 100755
--- a/spec/functions/ensure_packages_spec.rb
+++ b/spec/functions/ensure_packages_spec.rb
@@ -33,4 +33,12 @@ describe 'ensure_packages' do
it { expect(lambda { catalogue }).to contain_package('facter').with_ensure('present').with_provider("gem") }
end
end
+
+ context 'given hash of packages' do
+ before { subject.call([{"foo" => { "provider" => "rpm" }, "bar" => { "provider" => "gem" }}, { "ensure" => "present"}]) }
+
+ # this lambda is required due to strangeness within rspec-puppet's expectation handling
+ it { expect(lambda { catalogue }).to contain_package('foo').with({'provider' => 'rpm', 'ensure' => 'present'}) }
+ it { expect(lambda { catalogue }).to contain_package('bar').with({'provider' => 'gem', 'ensure' => 'present'}) }
+ end
end