summaryrefslogtreecommitdiff
path: root/spec/functions
diff options
context:
space:
mode:
authortphoney <tp@puppet.com>2017-07-06 12:02:58 +0100
committertphoney <tp@puppet.com>2017-07-06 12:02:58 +0100
commit085496fd19c21bf2d02b8ad871d7cab850b92b93 (patch)
tree45a6a7caecd16e9cb0fe4c40cd794507c5a24349 /spec/functions
parentd85094eb73a898361e909ed2da8fcf466f1bb750 (diff)
(MODULES-5186) move test to correct location
Diffstat (limited to 'spec/functions')
-rw-r--r--spec/functions/ensure_resources_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/functions/ensure_resources_spec.rb b/spec/functions/ensure_resources_spec.rb
new file mode 100644
index 0000000..aea723e
--- /dev/null
+++ b/spec/functions/ensure_resources_spec.rb
@@ -0,0 +1,22 @@
+require 'spec_helper'
+
+describe 'test::ensure_resources', type: :class do
+ let(:params) {{ resource_type: 'user', title_hash: title_param, attributes_hash: {'ensure' => 'present'} }}
+
+ describe 'given a title hash of multiple resources' do
+
+ let(:title_param) { {'dan' => { 'gid' => 'mygroup', 'uid' => '600' }, 'alex' => { 'gid' => 'mygroup', 'uid' => '700'}} }
+
+ it { is_expected.to compile }
+ it { is_expected.to contain_user('dan').with({ 'gid' => 'mygroup', 'uid' => '600', 'ensure' => 'present'}) }
+ it { is_expected.to contain_user('alex').with({ 'gid' => 'mygroup', 'uid' => '700', 'ensure' => 'present'}) }
+ end
+
+ describe 'given a title hash of a single resource' do
+
+ let(:title_param) { {'dan' => { 'gid' => 'mygroup', 'uid' => '600' }} }
+
+ it { is_expected.to compile }
+ it { is_expected.to contain_user('dan').with({ 'gid' => 'mygroup', 'uid' => '600', 'ensure' => 'present'}) }
+ end
+end