Skip to content

Commit f812d07

Browse files
committed
(MODULES-3829) Add hash tests for ensure_packages
Prior to this commit, there was no test coverage for the case where a hash of packages is passed into the ensure_packages function. For the sake of improving test coverage, add a test for this.
1 parent 903d94e commit f812d07

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

spec/functions/ensure_packages_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,12 @@
3333
it { expect(lambda { catalogue }).to contain_package('facter').with_ensure('present').with_provider("gem") }
3434
end
3535
end
36+
37+
context 'given hash of packages' do
38+
before { subject.call([{"foo" => { "provider" => "rpm" }, "bar" => { "provider" => "gem" }}, { "ensure" => "present"}]) }
39+
40+
# this lambda is required due to strangeness within rspec-puppet's expectation handling
41+
it { expect(lambda { catalogue }).to contain_package('foo').with({'provider' => 'rpm', 'ensure' => 'present'}) }
42+
it { expect(lambda { catalogue }).to contain_package('bar').with({'provider' => 'gem', 'ensure' => 'present'}) }
43+
end
3644
end

0 commit comments

Comments
 (0)