1 #! /usr/bin/env ruby -S rspec
4 describe "the sort function" do
5 let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
8 expect(Puppet::Parser::Functions.function("sort")).to eq("function_sort")
11 it "should raise a ParseError if there is not 1 arguments" do
12 expect { scope.function_sort(['','']) }.to( raise_error(Puppet::ParseError))
15 it "should sort an array" do
16 result = scope.function_sort([["a","c","b"]])
17 expect(result).to(eq(['a','b','c']))
20 it "should sort a string" do
21 result = scope.function_sort(["acb"])
22 expect(result).to(eq('abc'))