1 #! /usr/bin/env ruby -S rspec
4 describe "the grep function" do
5 let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
8 expect(Puppet::Parser::Functions.function("grep")).to eq("function_grep")
11 it "should raise a ParseError if there is less than 1 arguments" do
12 expect { scope.function_grep([]) }.to( raise_error(Puppet::ParseError))
15 it "should grep contents from an array" do
16 result = scope.function_grep([["aaabbb","bbbccc","dddeee"], "bbb"])
17 expect(result).to(eq(["aaabbb","bbbccc"]))