Suggest different variables to use if we want to tunnel both v4 and v6
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / is_string_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'is_string function' do
4   describe 'success' do
5     pp1 = <<-DOC
6       $a = ['aaa.com','bbb','ccc']
7       $b = false
8       $o = is_string($a)
9       if $o == $b {
10         notify { 'output correct': }
11       }
12     DOC
13     it 'is_strings arrays' do
14       apply_manifest(pp1, :catch_failures => true) do |r|
15         expect(r.stdout).to match(%r{Notice: output correct})
16       end
17     end
18
19     pp2 = <<-DOC
20       $a = true
21       $b = false
22       $o = is_string($a)
23       if $o == $b {
24         notify { 'output correct': }
25       }
26     DOC
27     it 'is_strings true' do
28       apply_manifest(pp2, :catch_failures => true) do |r|
29         expect(r.stdout).to match(%r{Notice: output correct})
30       end
31     end
32
33     pp3 = <<-DOC
34       $a = "aoeu"
35       $o = is_string($a)
36       notice(inline_template('is_string is <%= @o.inspect %>'))
37     DOC
38     it 'is_strings strings' do
39       apply_manifest(pp3, :catch_failures => true) do |r|
40         expect(r.stdout).to match(%r{is_string is true})
41       end
42     end
43
44     pp4 = <<-DOC
45       $a = "3"
46       $o = is_string($a)
47       notice(inline_template('is_string is <%= @o.inspect %>'))
48     DOC
49     it 'is_strings number strings' do
50       apply_manifest(pp4, :catch_failures => true) do |r|
51         expect(r.stdout).to match(%r{is_string is false})
52       end
53     end
54
55     pp5 = <<-DOC
56       $a = 3.5
57       $b = false
58       $o = is_string($a)
59       if $o == $b {
60         notify { 'output correct': }
61       }
62     DOC
63     it 'is_strings floats' do
64       apply_manifest(pp5, :catch_failures => true) do |r|
65         expect(r.stdout).to match(%r{Notice: output correct})
66       end
67     end
68
69     pp6 = <<-DOC
70       $a = 3
71       $b = false
72       $o = is_string($a)
73       if $o == $b {
74         notify { 'output correct': }
75       }
76     DOC
77     it 'is_strings integers' do
78       apply_manifest(pp6, :catch_failures => true) do |r|
79         expect(r.stdout).to match(%r{Notice: output correct})
80       end
81     end
82
83     pp7 = <<-DOC
84       $a = {'aaa'=>'www.com'}
85       $b = false
86       $o = is_string($a)
87       if $o == $b {
88         notify { 'output correct': }
89       }
90     DOC
91     it 'is_strings hashes' do
92       apply_manifest(pp7, :catch_failures => true) do |r|
93         expect(r.stdout).to match(%r{Notice: output correct})
94       end
95     end
96
97     pp8 = <<-DOC
98       $a = undef
99       $o = is_string($a)
100       notice(inline_template('is_string is <%= @o.inspect %>'))
101     DOC
102     it 'is_strings undef' do
103       apply_manifest(pp8, :catch_failures => true) do |r|
104         expect(r.stdout).to match(%r{is_string is true})
105       end
106     end
107   end
108   describe 'failure' do
109     it 'handles improper argument counts'
110   end
111 end