1 #! /usr/bin/env ruby -S rspec
4 describe "the suffix function" do
5 let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
7 it "raises a ParseError if there is less than 1 arguments" do
8 expect { scope.function_suffix([]) }.to raise_error(Puppet::ParseError, /number of arguments/)
11 it "raises an error if the first argument is not an array" do
13 scope.function_suffix([Object.new])
14 }.to raise_error(Puppet::ParseError, /expected first argument to be an Array/)
17 it "raises an error if the second argument is not a string" do
19 scope.function_suffix([['first', 'second'], 42])
20 }.to raise_error(Puppet::ParseError, /expected second argument to be a String/)
23 it "returns a suffixed array" do
24 result = scope.function_suffix([['a','b','c'], 'p'])
25 expect(result).to(eq(['ap','bp','cp']))