Suggest different variables to use if we want to tunnel both v4 and v6
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / prefix_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'prefix function' do
4   describe 'success' do
5     pp1 = <<-DOC
6       $o = prefix(['a','b','c'],'p')
7       notice(inline_template('prefix is <%= @o.inspect %>'))
8     DOC
9     it 'prefixes array of values' do
10       apply_manifest(pp1, :catch_failures => true) do |r|
11         expect(r.stdout).to match(%r{prefix is \["pa", "pb", "pc"\]})
12       end
13     end
14
15     pp2 = <<-DOC
16       $o = prefix([],'p')
17       notice(inline_template('prefix is <%= @o.inspect %>'))
18     DOC
19     it 'prefixs with empty array' do
20       apply_manifest(pp2, :catch_failures => true) do |r|
21         expect(r.stdout).to match(%r{prefix is \[\]})
22       end
23     end
24
25     pp3 = <<-DOC
26       $o = prefix(['a','b','c'], undef)
27       notice(inline_template('prefix is <%= @o.inspect %>'))
28     DOC
29     it 'prefixs array of values with undef' do
30       apply_manifest(pp3, :catch_failures => true) do |r|
31         expect(r.stdout).to match(%r{prefix is \["a", "b", "c"\]})
32       end
33     end
34   end
35   describe 'failure' do
36     it 'fails with no arguments'
37     it 'fails when first argument is not array'
38     it 'fails when second argument is not string'
39   end
40 end