4 describe "the shuffle function" do
6 Puppet::Parser::Functions.autoloader.loadall
10 @scope = Puppet::Parser::Scope.new
14 Puppet::Parser::Functions.function("shuffle").should == "function_shuffle"
17 it "should raise a ParseError if there is less than 1 arguments" do
18 lambda { @scope.function_shuffle([]) }.should( raise_error(Puppet::ParseError))
21 it "should shuffle a string and the result should be the same size" do
22 result = @scope.function_shuffle(["asdf"])
23 result.size.should(eq(4))
26 it "should shuffle a string but the sorted contents should still be the same" do
27 result = @scope.function_shuffle(["adfs"])
28 result.split("").sort.join("").should(eq("adfs"))