1 #! /usr/bin/env ruby -S rspec
4 describe "the member function" do
5 let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
8 expect(Puppet::Parser::Functions.function("member")).to eq("function_member")
11 it "should raise a ParseError if there is less than 1 arguments" do
12 expect { scope.function_member([]) }.to( raise_error(Puppet::ParseError))
15 it "should return true if a member is in an array" do
16 result = scope.function_member([["a","b","c"], "a"])
17 expect(result).to(eq(true))
20 it "should return false if a member is not in an array" do
21 result = scope.function_member([["a","b","c"], "d"])
22 expect(result).to(eq(false))
25 it "should return true if a member array is in an array" do
26 result = scope.function_member([["a","b","c"], ["a", "b"]])
27 expect(result).to(eq(true))
30 it "should return false if a member array is not in an array" do
31 result = scope.function_member([["a","b","c"], ["d", "e"]])
32 expect(result).to(eq(false))