Update stdlib and concat to 6.1.0 both
[mirror/dsa-puppet.git] / 3rdparty / modules / concat / spec / acceptance / pup_1963_spec.rb
1 require 'spec_helper_acceptance'
2
3 command = case os[:family]
4           when 'windows'
5             'cmd.exe /c echo triggered'
6           else
7             'echo triggered'
8           end
9
10 describe 'with metaparameters' do
11   before(:each) do
12     @basedir = setup_test_directory
13   end
14
15   describe 'with subscribed resources' do
16     let(:pp) do
17       <<-MANIFEST
18         concat { "foobar":
19           ensure => 'present',
20           path   => '#{@basedir}/foobar',
21         }
22
23         concat::fragment { 'foo':
24           target => 'foobar',
25           content => 'foo',
26         }
27
28         exec { 'trigger':
29           path        => $::path,
30           command     => "#{command}",
31           subscribe   => Concat['foobar'],
32           refreshonly => true,
33         }
34       MANIFEST
35     end
36
37     it 'applies the manifest twice with no changes second apply' do
38       expect(apply_manifest(pp, catch_failures: true).stdout).to match(%r{Triggered 'refresh'})
39       expect(apply_manifest(pp, catch_changes: true).stdout).not_to match(%r{Triggered 'refresh'})
40     end
41   end
42
43   describe 'with resources to notify' do
44     let(:pp) do
45       <<-MANIFEST
46         exec { 'trigger':
47           path        => $::path,
48           command     => "#{command}",
49           refreshonly => true,
50         }
51
52         concat { "foobar":
53           ensure => 'present',
54           path   => '#{@basedir}/foobar',
55           notify => Exec['trigger'],
56         }
57
58         concat::fragment { 'foo':
59           target => 'foobar',
60           content => 'foo',
61         }
62       MANIFEST
63     end
64
65     it 'applies the manifest twice with no changes second apply' do
66       expect(apply_manifest(pp, catch_failures: true).stdout).to match(%r{Triggered 'refresh'})
67       expect(apply_manifest(pp, catch_changes: true).stdout).not_to match(%r{Triggered 'refresh'})
68     end
69   end
70 end