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