summaryrefslogtreecommitdiff
path: root/spec/functions/defined_with_params_spec.rb
diff options
context:
space:
mode:
authorDavid Schmitt <david@black.co.at>2016-06-29 21:33:00 +0100
committerDavid Schmitt <david@black.co.at>2016-06-29 21:33:00 +0100
commitaf875b11ff284cfe2ea95d208a614576a4342b2c (patch)
tree450f264f6fb674a7c4be7073e98c334f11a54b9b /spec/functions/defined_with_params_spec.rb
parent50cf8bd5b77ba6353ab6477c4c76f437b834b6b0 (diff)
(MODULES-3543) Fix define_with_params to handle undef properly
As described in PUP-6422, ensure_resources('File[/tmp/a]', { owner => undef }) would not actually create the file. This fixes it, and adds tests to prove it.
Diffstat (limited to 'spec/functions/defined_with_params_spec.rb')
-rwxr-xr-xspec/functions/defined_with_params_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/functions/defined_with_params_spec.rb b/spec/functions/defined_with_params_spec.rb
index 516d986..e00c423 100755
--- a/spec/functions/defined_with_params_spec.rb
+++ b/spec/functions/defined_with_params_spec.rb
@@ -23,4 +23,13 @@ describe 'defined_with_params' do
it { is_expected.to run.with_params('User[dan]', {'ensure' => 'present', 'managehome' => false}).and_return(true) }
it { is_expected.to run.with_params('User[dan]', {'ensure' => 'absent', 'managehome' => false}).and_return(false) }
end
+
+ describe 'when passing undef values' do
+ let :pre_condition do
+ 'file { "/tmp/a": }'
+ end
+
+ it { is_expected.to run.with_params('File[/tmp/a]', {}).and_return(true) }
+ it { is_expected.to run.with_params('File[/tmp/a]', { 'owner' => :undef }).and_return(true) }
+ end
end