]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/stdlib/spec/functions/suffix_spec.rb
upgrade to stdlib 4.6.1
[dsa-puppet.git] / 3rdparty / modules / stdlib / spec / functions / suffix_spec.rb
1 #! /usr/bin/env ruby -S rspec
2 require 'spec_helper'
3
4 describe "the suffix function" do
5   let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
6
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/)
9   end
10
11   it "raises an error if the first argument is not an array" do
12     expect {
13       scope.function_suffix([Object.new])
14     }.to raise_error(Puppet::ParseError, /expected first argument to be an Array/)
15   end
16
17   it "raises an error if the second argument is not a string" do
18     expect {
19       scope.function_suffix([['first', 'second'], 42])
20     }.to raise_error(Puppet::ParseError, /expected second argument to be a String/)
21   end
22
23   it "returns a suffixed array" do
24     result = scope.function_suffix([['a','b','c'], 'p'])
25     expect(result).to(eq(['ap','bp','cp']))
26   end
27 end