diff options
author | David Schmitt <david.schmitt@puppet.com> | 2016-10-04 13:48:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-04 13:48:30 +0100 |
commit | 440f98b45a79528c36c3286de70f5e8a2fe4466a (patch) | |
tree | 3222c9b0969de0df0d28b8e423f16440243e11cc /spec/acceptance | |
parent | 7228160175a17fb3d7f5b464553ef6c7791cf140 (diff) | |
parent | cce67b42bb6d09d4e9773b64e28c07d8a93ed088 (diff) |
Merge pull request #662 from domcleal/validate-string-undef
Permit undef passed as `nil` to validate_string
Diffstat (limited to 'spec/acceptance')
-rwxr-xr-x | spec/acceptance/is_string_spec.rb | 11 | ||||
-rwxr-xr-x | spec/acceptance/validate_string_spec.rb | 7 |
2 files changed, 18 insertions, 0 deletions
diff --git a/spec/acceptance/is_string_spec.rb b/spec/acceptance/is_string_spec.rb index 94d8e96..f526888 100755 --- a/spec/acceptance/is_string_spec.rb +++ b/spec/acceptance/is_string_spec.rb @@ -95,6 +95,17 @@ describe 'is_string function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('o expect(r.stdout).to match(/Notice: output correct/) end end + it 'is_strings undef' do + pp = <<-EOS + $a = undef + $o = is_string($a) + notice(inline_template('is_string is <%= @o.inspect %>')) + EOS + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/is_string is true/) + end + end end describe 'failure' do it 'handles improper argument counts' diff --git a/spec/acceptance/validate_string_spec.rb b/spec/acceptance/validate_string_spec.rb index 8956f48..ae3468f 100755 --- a/spec/acceptance/validate_string_spec.rb +++ b/spec/acceptance/validate_string_spec.rb @@ -20,6 +20,13 @@ describe 'validate_string function', :unless => UNSUPPORTED_PLATFORMS.include?(f apply_manifest(pp, :catch_failures => true) end + it 'validates undef' do + pp = <<-EOS + validate_string(undef) + EOS + + apply_manifest(pp, :catch_failures => true) + end it 'validates a non-string' do { %{validate_string({ 'a' => 'hash' })} => "Hash", |