1 | #! /usr/bin/env ruby -S rspec
|
---|
2 | require 'spec_helper_acceptance'
|
---|
3 |
|
---|
4 | describe 'is_function_available function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
---|
5 | describe 'success' do
|
---|
6 | it 'is_function_availables arrays' do
|
---|
7 | pp = <<-EOS
|
---|
8 | $a = ['fail','include','require']
|
---|
9 | $o = is_function_available($a)
|
---|
10 | notice(inline_template('is_function_available is <%= @o.inspect %>'))
|
---|
11 | EOS
|
---|
12 |
|
---|
13 | apply_manifest(pp, :catch_failures => true) do |r|
|
---|
14 | expect(r.stdout).to match(/is_function_available is false/)
|
---|
15 | end
|
---|
16 | end
|
---|
17 | it 'is_function_availables true' do
|
---|
18 | pp = <<-EOS
|
---|
19 | $a = true
|
---|
20 | $o = is_function_available($a)
|
---|
21 | notice(inline_template('is_function_available is <%= @o.inspect %>'))
|
---|
22 | EOS
|
---|
23 |
|
---|
24 | apply_manifest(pp, :catch_failures => true) do |r|
|
---|
25 | expect(r.stdout).to match(/is_function_available is false/)
|
---|
26 | end
|
---|
27 | end
|
---|
28 | it 'is_function_availables strings' do
|
---|
29 | pp = <<-EOS
|
---|
30 | $a = "fail"
|
---|
31 | $b = true
|
---|
32 | $o = is_function_available($a)
|
---|
33 | if $o == $b {
|
---|
34 | notify { 'output correct': }
|
---|
35 | }
|
---|
36 | EOS
|
---|
37 |
|
---|
38 | apply_manifest(pp, :catch_failures => true) do |r|
|
---|
39 | expect(r.stdout).to match(/Notice: output correct/)
|
---|
40 | end
|
---|
41 | end
|
---|
42 | it 'is_function_availables function_availables' do
|
---|
43 | pp = <<-EOS
|
---|
44 | $a = "is_function_available"
|
---|
45 | $o = is_function_available($a)
|
---|
46 | notice(inline_template('is_function_available is <%= @o.inspect %>'))
|
---|
47 | EOS
|
---|
48 |
|
---|
49 | apply_manifest(pp, :catch_failures => true) do |r|
|
---|
50 | expect(r.stdout).to match(/is_function_available is true/)
|
---|
51 | end
|
---|
52 | end
|
---|
53 | end
|
---|
54 | describe 'failure' do
|
---|
55 | it 'handles improper argument counts'
|
---|
56 | it 'handles non-arrays'
|
---|
57 | end
|
---|
58 | end
|
---|