4 describe "the abs function" do
6 Puppet::Parser::Functions.autoloader.loadall
10 @scope = Puppet::Parser::Scope.new
14 Puppet::Parser::Functions.function("abs").should == "function_abs"
17 it "should raise a ParseError if there is less than 1 arguments" do
18 lambda { @scope.function_abs([]) }.should( raise_error(Puppet::ParseError))
21 it "should convert a negative number into a positive" do
22 result = @scope.function_abs(["-34"])
26 it "should do nothing with a positive number" do
27 result = @scope.function_abs(["5678"])
28 result.should(eq(5678))