Update stdlib and concat to 6.1.0 both
[mirror/dsa-puppet.git] / 3rdparty / modules / concat / spec / acceptance / warn_header_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'concat warn_header =>' do
4   before(:all) do
5     @basedir = setup_test_directory
6   end
7
8   describe 'applies the manifest twice with no stderr' do
9     let(:pp) do
10       <<-MANIFEST
11       concat { '#{@basedir}/file':
12         warn  => true,
13       }
14
15       concat::fragment { '1':
16         target  => '#{@basedir}/file',
17         content => '1',
18         order   => '01',
19       }
20
21       concat::fragment { '2':
22         target  => '#{@basedir}/file',
23         content => '2',
24         order   => '02',
25       }
26
27       concat { '#{@basedir}/file2':
28         warn  => false,
29       }
30
31       concat::fragment { 'file2_1':
32         target  => '#{@basedir}/file2',
33         content => '1',
34         order   => '01',
35       }
36
37       concat::fragment { 'file2_2':
38         target  => '#{@basedir}/file2',
39         content => '2',
40         order   => '02',
41       }
42
43       concat { '#{@basedir}/file3':
44         warn  => "# foo\n",
45       }
46
47       concat::fragment { 'file3_1':
48         target  => '#{@basedir}/file3',
49         content => '1',
50         order   => '01',
51       }
52
53       concat::fragment { 'file3_2':
54         target  => '#{@basedir}/file3',
55         content => '2',
56         order   => '02',
57       }
58
59     MANIFEST
60     end
61
62     it 'when true should enable default warning message' do
63       idempotent_apply(pp)
64       expect(file("#{@basedir}/file")).to be_file
65       expect(file("#{@basedir}/file").content).to match %r{# This file is managed by Puppet\. DO NOT EDIT\.}
66       expect(file("#{@basedir}/file").content).to match %r{1}
67       expect(file("#{@basedir}/file").content).to match %r{2}
68     end
69
70     it 'when false should not enable default warning message' do
71       expect(file("#{@basedir}/file2")).to be_file
72       expect(file("#{@basedir}/file2").content).not_to match %r{# This file is managed by Puppet\. DO NOT EDIT\.}
73       expect(file("#{@basedir}/file2").content).to match %r{1}
74       expect(file("#{@basedir}/file2").content).to match %r{2}
75     end
76
77     it 'when foo should overide default warning message' do
78       expect(file("#{@basedir}/file3")).to be_file
79       expect(file("#{@basedir}/file3").content).to match %r{# foo}
80       expect(file("#{@basedir}/file3").content).to match %r{1}
81       expect(file("#{@basedir}/file3").content).to match %r{2}
82     end
83   end
84 end