Suggest different variables to use if we want to tunnel both v4 and v6
[mirror/dsa-puppet.git] / 3rdparty / modules / concat / spec / acceptance / pup-1963_spec.rb
1 require 'spec_helper_acceptance'
2
3 case fact('osfamily')
4   when 'Windows'
5     command = 'cmd.exe /c echo triggered'
6   else
7     command = 'echo triggered'
8 end
9
10 describe 'with metaparameters' do
11   describe 'with subscribed resources' do
12     basedir = default.tmpdir('concat')
13
14     context 'should trigger refresh' do
15       pp = <<-EOS
16         concat { "foobar":
17           ensure => 'present',
18           path   => '#{basedir}/foobar',
19         }
20
21         concat::fragment { 'foo':
22           target => 'foobar',
23           content => 'foo',
24         }
25
26         exec { 'trigger':
27           path        => $::path,
28           command     => "#{command}",
29           subscribe   => Concat['foobar'],
30           refreshonly => true,
31         }
32       EOS
33
34       it 'applies the manifest twice with stdout regex' do
35         expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/Triggered 'refresh'/)
36         expect(apply_manifest(pp, :catch_changes => true).stdout).to_not match(/Triggered 'refresh'/)
37       end
38     end
39   end
40
41   describe 'with resources to notify' do
42     basedir = default.tmpdir('concat')
43     context 'should notify' do
44       pp = <<-EOS
45         exec { 'trigger':
46           path        => $::path,
47           command     => "#{command}",
48           refreshonly => true,
49         }
50
51         concat { "foobar":
52           ensure => 'present',
53           path   => '#{basedir}/foobar',
54           notify => Exec['trigger'],
55         }
56
57         concat::fragment { 'foo':
58           target => 'foobar',
59           content => 'foo',
60         }
61       EOS
62
63       it 'applies the manifest twice with stdout regex' do
64         expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/Triggered 'refresh'/)
65         expect(apply_manifest(pp, :catch_changes => true).stdout).to_not match(/Triggered 'refresh'/)
66       end
67     end
68   end
69 end