1 #! /usr/bin/env ruby -S rspec
4 describe "the is_hash function" do
5 let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
8 expect(Puppet::Parser::Functions.function("is_hash")).to eq("function_is_hash")
11 it "should raise a ParseError if there is less than 1 arguments" do
12 expect { scope.function_is_hash([]) }.to( raise_error(Puppet::ParseError))
15 it "should return true if passed a hash" do
16 result = scope.function_is_hash([{"a"=>1,"b"=>2}])
17 expect(result).to(eq(true))
20 it "should return false if passed an array" do
21 result = scope.function_is_hash([["a","b"]])
22 expect(result).to(eq(false))
25 it "should return false if passed a string" do
26 result = scope.function_is_hash(["asdf"])
27 expect(result).to(eq(false))