1 #! /usr/bin/env ruby -S rspec
5 describe "the max function" do
6 let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
9 expect(Puppet::Parser::Functions.function("max")).to eq("function_max")
12 it "should raise a ParseError if there is less than 1 arguments" do
13 expect { scope.function_max([]) }.to( raise_error(Puppet::ParseError))
16 it "should be able to compare strings" do
17 expect(scope.function_max(["albatross","dog","horse"])).to(eq("horse"))
20 it "should be able to compare numbers" do
21 expect(scope.function_max([6,8,4])).to(eq(8))
24 it "should be able to compare a number with a stringified number" do
25 expect(scope.function_max([1,"2"])).to(eq("2"))