[30903] | 1 | require 'spec_helper'
|
---|
| 2 |
|
---|
| 3 | describe 'ensure_packages' do
|
---|
| 4 | it { is_expected.not_to eq(nil) }
|
---|
| 5 | it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError) }
|
---|
| 6 | it {
|
---|
| 7 | pending("should not accept numbers as arguments")
|
---|
| 8 | is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError)
|
---|
| 9 | }
|
---|
| 10 | it {
|
---|
| 11 | pending("should not accept numbers as arguments")
|
---|
| 12 | is_expected.to run.with_params(["packagename", 1]).and_raise_error(Puppet::ParseError)
|
---|
| 13 | }
|
---|
| 14 | it { is_expected.to run.with_params("packagename") }
|
---|
| 15 | it { is_expected.to run.with_params(["packagename1", "packagename2"]) }
|
---|
| 16 |
|
---|
| 17 | context 'given a catalog with "package { puppet: ensure => absent }"' do
|
---|
| 18 | let(:pre_condition) { 'package { puppet: ensure => absent }' }
|
---|
| 19 |
|
---|
| 20 | describe 'after running ensure_package("facter")' do
|
---|
| 21 | before { subject.call(['facter']) }
|
---|
| 22 |
|
---|
| 23 | # this lambda is required due to strangeness within rspec-puppet's expectation handling
|
---|
| 24 | it { expect(lambda { catalogue }).to contain_package('puppet').with_ensure('absent') }
|
---|
| 25 | it { expect(lambda { catalogue }).to contain_package('facter').with_ensure('present') }
|
---|
| 26 | end
|
---|
| 27 |
|
---|
| 28 | describe 'after running ensure_package("facter", { "provider" => "gem" })' do
|
---|
| 29 | before { subject.call(['facter', { "provider" => "gem" }]) }
|
---|
| 30 |
|
---|
| 31 | # this lambda is required due to strangeness within rspec-puppet's expectation handling
|
---|
| 32 | it { expect(lambda { catalogue }).to contain_package('puppet').with_ensure('absent').without_provider() }
|
---|
| 33 | it { expect(lambda { catalogue }).to contain_package('facter').with_ensure('present').with_provider("gem") }
|
---|
| 34 | end
|
---|
| 35 | end
|
---|
| 36 | end
|
---|