From 55ece7815a8718507ef096db53a1e186102f1c8a Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Thu, 17 Sep 2015 18:48:32 +0100 Subject: (MAINT) validate_re: Clarify docs and error message --- spec/functions/validate_re_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'spec/functions') 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 -- cgit v1.2.3