) do |arguments|
if (arguments.size != 1) then
- raise(Puppet::ParseError, "is_valid_netmask(): Wrong number of arguments "+
+ raise(Puppet::ParseError, "date(): Wrong number of arguments "+
"given #{arguments.size} for 1")
end
lambda { @scope.function_bool2num([]) }.should( raise_error(Puppet::ParseError))
end
+ it "should convert true to 1" do
+ result = @scope.function_bool2num([true])
+ result.should(eq(1))
+ end
+
+ it "should convert false to 0" do
+ result = @scope.function_bool2num([false])
+ result.should(eq(0))
+ end
+
end
lambda { @scope.function_capitalize([]) }.should( raise_error(Puppet::ParseError))
end
+ it "should capitalize the beginning of a string" do
+ result = @scope.function_capitalize(["abc"])
+ result.should(eq("Abc"))
+ end
+
end
lambda { @scope.function_chomp([]) }.should( raise_error(Puppet::ParseError))
end
+ it "should chomp the end of a string" do
+ result = @scope.function_chomp(["abc\n"])
+ result.should(eq("abc"))
+ end
+
end
lambda { @scope.function_chop([]) }.should( raise_error(Puppet::ParseError))
end
+ it "should chop the end of a string" do
+ result = @scope.function_chop(["asdf\n"])
+ result.should(eq("asdf"))
+ end
+
end
lambda { @scope.function_count([]) }.should( raise_error(Puppet::ParseError))
end
+ it "should return the size of an array" do
+ result = @scope.function_count([['a','c','b']])
+ result.should(eq(3))
+ end
+
end