1 #! /usr/bin/env ruby -S rspec
4 describe "the hash function" do
5 let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
8 expect(Puppet::Parser::Functions.function("hash")).to eq("function_hash")
11 it "should raise a ParseError if there is less than 1 arguments" do
12 expect { scope.function_hash([]) }.to( raise_error(Puppet::ParseError))
15 it "should convert an array to a hash" do
16 result = scope.function_hash([['a',1,'b',2,'c',3]])
17 expect(result).to(eq({'a'=>1,'b'=>2,'c'=>3}))