summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDavid Schmitt <david.schmitt@puppetlabs.com>2015-09-28 17:11:10 +0100
committerDavid Schmitt <david.schmitt@puppetlabs.com>2015-09-28 17:11:10 +0100
commit76db98120acab12d5aab3adaff6d2aa1d970c1e8 (patch)
tree00140d6f633d63232a3408d85d7e5a42b497b457 /spec
parent48b658fc1c948103eaf04cd10671dd1a6fd61b8c (diff)
parentc7c4d41a8286ab05af65afc1207c8cea4c11ffff (diff)
downloadpuppet-stdlib-76db98120acab12d5aab3adaff6d2aa1d970c1e8.tar.gz
puppet-stdlib-76db98120acab12d5aab3adaff6d2aa1d970c1e8.tar.bz2
Merge pull request #533 from HelenCampbell/MODULES-2614-Improved
Modules 2614 improved numeric value handling on empty function
Diffstat (limited to 'spec')
-rwxr-xr-xspec/acceptance/empty_spec.rb14
-rwxr-xr-xspec/functions/empty_spec.rb2
2 files changed, 15 insertions, 1 deletions
diff --git a/spec/acceptance/empty_spec.rb b/spec/acceptance/empty_spec.rb
index 8b46aac..2d4df90 100755
--- a/spec/acceptance/empty_spec.rb
+++ b/spec/acceptance/empty_spec.rb
@@ -31,6 +31,20 @@ describe 'empty function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('opera
expect(r.stdout).to match(/Notice: output correct/)
end
end
+ it 'handles numerical values' do
+ pp = <<-EOS
+ $a = 7
+ $b = false
+ $o = empty($a)
+ if $o == $b {
+ notify { 'output correct': }
+ }
+ EOS
+
+ apply_manifest(pp, :catch_failures => true) do |r|
+ expect(r.stdout).to match(/Notice: output correct/)
+ end
+ end
end
describe 'failure' do
it 'handles improper argument counts'
diff --git a/spec/functions/empty_spec.rb b/spec/functions/empty_spec.rb
index 94b1c68..a3a25d6 100755
--- a/spec/functions/empty_spec.rb
+++ b/spec/functions/empty_spec.rb
@@ -3,11 +3,11 @@ require 'spec_helper'
describe 'empty' do
it { is_expected.not_to eq(nil) }
it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError) }
- it { is_expected.to run.with_params(0).and_raise_error(Puppet::ParseError) }
it {
pending("Current implementation ignores parameters after the first.")
is_expected.to run.with_params('one', 'two').and_raise_error(Puppet::ParseError)
}
+ it { is_expected.to run.with_params(0).and_return(false) }
it { is_expected.to run.with_params('').and_return(true) }
it { is_expected.to run.with_params('one').and_return(false) }