1 #! /usr/bin/env ruby -S rspec
5 describe "the abs function" do
6 let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
9 expect(Puppet::Parser::Functions.function("abs")).to eq("function_abs")
12 it "should raise a ParseError if there is less than 1 arguments" do
13 expect { scope.function_abs([]) }.to( raise_error(Puppet::ParseError))
16 it "should convert a negative number into a positive" do
17 result = scope.function_abs(["-34"])
18 expect(result).to(eq(34))
21 it "should do nothing with a positive number" do
22 result = scope.function_abs(["5678"])
23 expect(result).to(eq(5678))