4 describe "the str2bool function" do
6 Puppet::Parser::Functions.autoloader.loadall
10 @scope = Puppet::Parser::Scope.new
14 Puppet::Parser::Functions.function("str2bool").should == "function_str2bool"
17 it "should raise a ParseError if there is less than 1 arguments" do
18 lambda { @scope.function_str2bool([]) }.should( raise_error(Puppet::ParseError))
21 it "should convert string 'true' to true" do
22 result = @scope.function_str2bool(["true"])
23 result.should(eq(true))
26 it "should convert string 'undef' to false" do
27 result = @scope.function_str2bool(["undef"])
28 result.should(eq(false))