diff options
author | David Schmitt <david.schmitt@puppetlabs.com> | 2015-09-17 18:48:32 +0100 |
---|---|---|
committer | David Schmitt <david.schmitt@puppetlabs.com> | 2015-09-17 18:48:32 +0100 |
commit | 55ece7815a8718507ef096db53a1e186102f1c8a (patch) | |
tree | 0948f9b0923904a87fc4dd146e2900b4f616a2c1 /spec/functions | |
parent | 399ce03f6806b2226d5bcee52ab22235842c6e38 (diff) |
(MAINT) validate_re: Clarify docs and error message
Diffstat (limited to 'spec/functions')
-rwxr-xr-x | spec/functions/validate_re_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/functions/validate_re_spec.rb b/spec/functions/validate_re_spec.rb index 42b1049..3f90143 100755 --- a/spec/functions/validate_re_spec.rb +++ b/spec/functions/validate_re_spec.rb @@ -41,6 +41,21 @@ describe 'validate_re' do it { is_expected.to run.with_params('notone', '^one').and_raise_error(Puppet::ParseError, /does not match/) } it { is_expected.to run.with_params('notone', [ '^one', '^two' ]).and_raise_error(Puppet::ParseError, /does not match/) } it { is_expected.to run.with_params('notone', [ '^one', '^two' ], 'custom error').and_raise_error(Puppet::ParseError, /custom error/) } + + describe 'non-string inputs' do + [ + 1, # Fixnum + 3.14, # Float + nil, # NilClass + true, # TrueClass + false, # FalseClass + ["10"], # Array + :key, # Symbol + {:key=>"val"}, # Hash + ].each do |input| + it { is_expected.to run.with_params(input, '.*').and_raise_error(Puppet::ParseError, /needs to be a String/) } + end + end end end end |