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, %r{Must specify a type}) }
6 it { is_expected.to run.with_params('type').and_raise_error(ArgumentError, %r{Must specify a title}) }
8 describe 'given a title hash of multiple resources' do
10 subject.execute('user', { 'dan' => { 'gid' => 'mygroup', 'uid' => '600' }, 'alex' => { 'gid' => 'mygroup', 'uid' => '700' } }, 'ensure' => 'present')
13 # this lambda is required due to strangeness within rspec-puppet's expectation handling
14 it { expect(-> { catalogue }).to contain_user('dan').with_ensure('present') }
15 it { expect(-> { catalogue }).to contain_user('alex').with_ensure('present') }
16 it { expect(-> { catalogue }).to contain_user('dan').with('gid' => 'mygroup', 'uid' => '600') }
17 it { expect(-> { catalogue }).to contain_user('alex').with('gid' => 'mygroup', 'uid' => '700') }
20 describe 'given a title hash of a single resource' do
21 before(:each) { subject.execute('user', { 'dan' => { 'gid' => 'mygroup', 'uid' => '600' } }, 'ensure' => 'present') }
23 # this lambda is required due to strangeness within rspec-puppet's expectation handling
24 it { expect(-> { catalogue }).to contain_user('dan').with_ensure('present') }
25 it { expect(-> { catalogue }).to contain_user('dan').with('gid' => 'mygroup', 'uid' => '600') }