From 18e5302614bce168ac07e35dc23b058064e9e41c Mon Sep 17 00:00:00 2001 From: Ken Barber Date: Fri, 29 Jul 2011 20:11:47 +0100 Subject: (#2) fix is_string finally so it also makes sure numbers return false. --- spec/unit/parser/functions/is_string_spec.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'spec/unit') diff --git a/spec/unit/parser/functions/is_string_spec.rb b/spec/unit/parser/functions/is_string_spec.rb index 8c0061e..4f3f5fd 100644 --- a/spec/unit/parser/functions/is_string_spec.rb +++ b/spec/unit/parser/functions/is_string_spec.rb @@ -18,4 +18,24 @@ describe "the is_string function" do lambda { @scope.function_is_string([]) }.should( raise_error(Puppet::ParseError)) end + it "should return true if a string" do + result = @scope.function_is_string(["asdf"]) + result.should(eq(true)) + end + + it "should return false if an integer" do + result = @scope.function_is_string(["3"]) + result.should(eq(false)) + end + + it "should return false if a float" do + result = @scope.function_is_string(["3.23"]) + result.should(eq(false)) + end + + it "should return false if an array" do + result = @scope.function_is_string([["a","b","c"]]) + result.should(eq(false)) + end + end -- cgit v1.2.3