1 | #! /usr/bin/env ruby -S rspec
|
---|
2 | require 'spec_helper_acceptance'
|
---|
3 |
|
---|
4 | describe 'is_integer function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
---|
5 | describe 'success' do
|
---|
6 | it 'is_integers arrays' do
|
---|
7 | pp = <<-EOS
|
---|
8 | $a = ['aaa.com','bbb','ccc']
|
---|
9 | $b = false
|
---|
10 | $o = is_integer($a)
|
---|
11 | if $o == $b {
|
---|
12 | notify { 'output correct': }
|
---|
13 | }
|
---|
14 | EOS
|
---|
15 |
|
---|
16 | apply_manifest(pp, :catch_failures => true) do |r|
|
---|
17 | expect(r.stdout).to match(/Notice: output correct/)
|
---|
18 | end
|
---|
19 | end
|
---|
20 | it 'is_integers true' do
|
---|
21 | pp = <<-EOS
|
---|
22 | $a = true
|
---|
23 | $b = false
|
---|
24 | $o = is_integer($a)
|
---|
25 | if $o == $b {
|
---|
26 | notify { 'output correct': }
|
---|
27 | }
|
---|
28 | EOS
|
---|
29 |
|
---|
30 | apply_manifest(pp, :catch_failures => true) do |r|
|
---|
31 | expect(r.stdout).to match(/Notice: output correct/)
|
---|
32 | end
|
---|
33 | end
|
---|
34 | it 'is_integers strings' do
|
---|
35 | pp = <<-EOS
|
---|
36 | $a = "3"
|
---|
37 | $b = true
|
---|
38 | $o = is_integer($a)
|
---|
39 | if $o == $b {
|
---|
40 | notify { 'output correct': }
|
---|
41 | }
|
---|
42 | EOS
|
---|
43 |
|
---|
44 | apply_manifest(pp, :catch_failures => true) do |r|
|
---|
45 | expect(r.stdout).to match(/Notice: output correct/)
|
---|
46 | end
|
---|
47 | end
|
---|
48 | it 'is_integers floats' do
|
---|
49 | pp = <<-EOS
|
---|
50 | $a = 3.5
|
---|
51 | $b = false
|
---|
52 | $o = is_integer($a)
|
---|
53 | if $o == $b {
|
---|
54 | notify { 'output correct': }
|
---|
55 | }
|
---|
56 | EOS
|
---|
57 |
|
---|
58 | apply_manifest(pp, :catch_failures => true) do |r|
|
---|
59 | expect(r.stdout).to match(/Notice: output correct/)
|
---|
60 | end
|
---|
61 | end
|
---|
62 | it 'is_integers integers' do
|
---|
63 | pp = <<-EOS
|
---|
64 | $a = 3
|
---|
65 | $b = true
|
---|
66 | $o = is_integer($a)
|
---|
67 | if $o == $b {
|
---|
68 | notify { 'output correct': }
|
---|
69 | }
|
---|
70 | EOS
|
---|
71 |
|
---|
72 | apply_manifest(pp, :catch_failures => true) do |r|
|
---|
73 | expect(r.stdout).to match(/Notice: output correct/)
|
---|
74 | end
|
---|
75 | end
|
---|
76 | it 'is_integers hashes' do
|
---|
77 | pp = <<-EOS
|
---|
78 | $a = {'aaa'=>'www.com'}
|
---|
79 | $b = false
|
---|
80 | $o = is_integer($a)
|
---|
81 | if $o == $b {
|
---|
82 | notify { 'output correct': }
|
---|
83 | }
|
---|
84 | EOS
|
---|
85 |
|
---|
86 | apply_manifest(pp, :catch_failures => true) do |r|
|
---|
87 | expect(r.stdout).to match(/Notice: output correct/)
|
---|
88 | end
|
---|
89 | end
|
---|
90 | end
|
---|
91 | describe 'failure' do
|
---|
92 | it 'handles improper argument counts'
|
---|
93 | it 'handles non-arrays'
|
---|
94 | end
|
---|
95 | end
|
---|