Suggest different variables to use if we want to tunnel both v4 and v6
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / validate_cmd_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'validate_cmd function' do
4   describe 'success' do
5     pp1 = <<-DOC
6       $one = 'foo'
7       if $::osfamily == 'windows' {
8         $two = 'echo' #shell built-in
9       } else {
10         $two = '/bin/echo'
11       }
12       validate_cmd($one,$two)
13     DOC
14     it 'validates a true command' do
15       apply_manifest(pp1, :catch_failures => true)
16     end
17
18     pp2 = <<-DOC
19       $one = 'foo'
20       if $::osfamily == 'windows' {
21         $two = 'C:/aoeu'
22       } else {
23         $two = '/bin/aoeu'
24       }
25       validate_cmd($one,$two)
26     DOC
27     it 'validates a fail command' do
28       apply_manifest(pp2, :expect_failures => true)
29     end
30
31     pp3 = <<-DOC
32       $one = 'foo'
33       if $::osfamily == 'windows' {
34         $two = 'C:/aoeu'
35       } else {
36         $two = '/bin/aoeu'
37       }
38       validate_cmd($one,$two,"aoeu is dvorak")
39     DOC
40     it 'validates a fail command with a custom error message' do
41       apply_manifest(pp3, :expect_failures => true) do |output|
42         expect(output.stderr).to match(%r{aoeu is dvorak})
43       end
44     end
45   end
46   describe 'failure' do
47     it 'handles improper number of arguments'
48     it 'handles improper argument types'
49   end
50 end