From 557d38bdc63b9b7d418f4bf0ce736406e71380b7 Mon Sep 17 00:00:00 2001 From: Ryan McKern Date: Thu, 15 May 2014 16:45:02 -0700 Subject: [PATCH] (MODULES-905) Extend spec tests for bool2str The extended spec tests validate that the common types of values that could be passed to bool2str() are rejected. --- spec/unit/puppet/parser/functions/bool2str_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/unit/puppet/parser/functions/bool2str_spec.rb b/spec/unit/puppet/parser/functions/bool2str_spec.rb index c73f7df11..bed7e68a0 100755 --- a/spec/unit/puppet/parser/functions/bool2str_spec.rb +++ b/spec/unit/puppet/parser/functions/bool2str_spec.rb @@ -31,4 +31,16 @@ result = scope.function_bool2str([false]) result.class.should(eq(String)) end + + it "should not accept a string" do + lambda { scope.function_bool2str(["false"]) }.should( raise_error(Puppet::ParseError)) + end + + it "should not accept a nil value" do + lambda { scope.function_bool2str([nil]) }.should( raise_error(Puppet::ParseError)) + end + + it "should not accept an undef" do + lambda { scope.function_bool2str([:undef]) }.should( raise_error(Puppet::ParseError)) + end end