Suggest different variables to use if we want to tunnel both v4 and v6
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / reject_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'reject function' do
4   describe 'success' do
5     pp1 = <<-DOC
6       $o = reject(['aaa','bbb','ccc','aaaddd'], 'aaa')
7       notice(inline_template('reject is <%= @o.inspect %>'))
8     DOC
9     it 'rejects array of values' do
10       apply_manifest(pp1, :catch_failures => true) do |r|
11         expect(r.stdout).to match(%r{reject is \["bbb", "ccc"\]})
12       end
13     end
14
15     pp2 = <<-DOC
16       $o = reject([],'aaa')
17       notice(inline_template('reject is <%= @o.inspect %>'))
18     DOC
19     it 'rejects with empty array' do
20       apply_manifest(pp2, :catch_failures => true) do |r|
21         expect(r.stdout).to match(%r{reject is \[\]})
22       end
23     end
24
25     pp3 = <<-DOC
26       $o = reject(['aaa','bbb','ccc','aaaddd'], undef)
27       notice(inline_template('reject is <%= @o.inspect %>'))
28     DOC
29     it 'rejects array of values with undef' do
30       apply_manifest(pp3, :catch_failures => true) do |r|
31         expect(r.stdout).to match(%r{reject is \[\]})
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