summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHunter Haugen <hunter@puppetlabs.com>2015-09-17 12:12:12 -0700
committerHunter Haugen <hunter@puppetlabs.com>2015-09-17 12:12:12 -0700
commit9b1932c538354c1b360838c8cf7b942af314c99d (patch)
tree0948f9b0923904a87fc4dd146e2900b4f616a2c1 /spec
parent399ce03f6806b2226d5bcee52ab22235842c6e38 (diff)
parent55ece7815a8718507ef096db53a1e186102f1c8a (diff)
Merge pull request #526 from DavidS/improve-validate_re-docs
(MAINT) validate_re: Clarify docs and error message
Diffstat (limited to 'spec')
-rwxr-xr-xspec/functions/validate_re_spec.rb15
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