4 describe "the is_string function" do
6 Puppet::Parser::Functions.autoloader.loadall
10 @scope = Puppet::Parser::Scope.new
14 Puppet::Parser::Functions.function("is_string").should == "function_is_string"
17 it "should raise a ParseError if there is less than 1 arguments" do
18 lambda { @scope.function_is_string([]) }.should( raise_error(Puppet::ParseError))
21 it "should return true if a string" do
22 result = @scope.function_is_string(["asdf"])
23 result.should(eq(true))
26 it "should return false if an integer" do
27 result = @scope.function_is_string(["3"])
28 result.should(eq(false))
31 it "should return false if a float" do
32 result = @scope.function_is_string(["3.23"])
33 result.should(eq(false))
36 it "should return false if an array" do
37 result = @scope.function_is_string([["a","b","c"]])
38 result.should(eq(false))