diff options
author | David Schmitt <david.schmitt@puppet.com> | 2016-12-09 14:55:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-09 14:55:59 +0000 |
commit | f63644a0385f5f27f4285b91ea6e367a515fdfc2 (patch) | |
tree | 6a50cd6fe21c0d14e315ae6b2c713327ccf60b17 /spec/unit/ensure_resources_spec.rb | |
parent | 7507af555361b2dcba8ed6189dc54c21e64ea031 (diff) | |
parent | 3312cc1f44d1acf25ce45701a74cecd647c50858 (diff) |
Merge pull request #697 from HAIL9000/issue/master/MODULES-3829_add_tests_for_ensure_resources
(MODULES-3829) Add tests for ensure_resources
Diffstat (limited to 'spec/unit/ensure_resources_spec.rb')
-rw-r--r-- | spec/unit/ensure_resources_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/unit/ensure_resources_spec.rb b/spec/unit/ensure_resources_spec.rb new file mode 100644 index 0000000..aea723e --- /dev/null +++ b/spec/unit/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 |