3 describe 'ensure_resources' do
4 it { is_expected.not_to eq(nil) }
5 it { is_expected.to run.with_params().and_raise_error(ArgumentError, /Must specify a type/) }
6 it { is_expected.to run.with_params('type').and_raise_error(ArgumentError, /Must specify a title/) }
8 describe 'given a title hash of multiple resources' do
9 before { subject.call(['user', {'dan' => { 'gid' => 'mygroup', 'uid' => '600' }, 'alex' => { 'gid' => 'mygroup', 'uid' => '700'}}, {'ensure' => 'present'}]) }
11 # this lambda is required due to strangeness within rspec-puppet's expectation handling
12 it { expect(lambda { catalogue }).to contain_user('dan').with_ensure('present') }
13 it { expect(lambda { catalogue }).to contain_user('alex').with_ensure('present') }
14 it { expect(lambda { catalogue }).to contain_user('dan').with({ 'gid' => 'mygroup', 'uid' => '600'}) }
15 it { expect(lambda { catalogue }).to contain_user('alex').with({ 'gid' => 'mygroup', 'uid' => '700'}) }
18 describe 'given a title hash of a single resource' do
19 before { subject.call(['user', {'dan' => { 'gid' => 'mygroup', 'uid' => '600' }}, {'ensure' => 'present'}]) }
21 # this lambda is required due to strangeness within rspec-puppet's expectation handling
22 it { expect(lambda { catalogue }).to contain_user('dan').with_ensure('present') }
23 it { expect(lambda { catalogue }).to contain_user('dan').with({ 'gid' => 'mygroup', 'uid' => '600'}) }