diff options
author | David Schmitt <david.schmitt@puppetlabs.com> | 2015-09-28 17:11:10 +0100 |
---|---|---|
committer | David Schmitt <david.schmitt@puppetlabs.com> | 2015-09-28 17:11:10 +0100 |
commit | 76db98120acab12d5aab3adaff6d2aa1d970c1e8 (patch) | |
tree | 00140d6f633d63232a3408d85d7e5a42b497b457 /spec | |
parent | 48b658fc1c948103eaf04cd10671dd1a6fd61b8c (diff) | |
parent | c7c4d41a8286ab05af65afc1207c8cea4c11ffff (diff) | |
download | puppet-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-x | spec/acceptance/empty_spec.rb | 14 | ||||
-rwxr-xr-x | spec/functions/empty_spec.rb | 2 |
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) } |