upgrade to concat 2.0.0
[mirror/dsa-puppet.git] / 3rdparty / modules / concat / spec / acceptance / newline_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'concat ensure_newline parameter' do
4   basedir = default.tmpdir('concat')
5   context '=> false' do
6     before(:all) do
7       pp = <<-EOS
8         file { '#{basedir}':
9           ensure => directory
10         }
11       EOS
12
13       apply_manifest(pp)
14     end
15     pp = <<-EOS
16       concat { '#{basedir}/file':
17         ensure_newline => false,
18       }
19       concat::fragment { '1':
20         target  => '#{basedir}/file',
21         content => '1',
22       }
23       concat::fragment { '2':
24         target  => '#{basedir}/file',
25         content => '2',
26       }
27     EOS
28
29     it 'applies the manifest twice with no stderr' do
30       apply_manifest(pp, :catch_failures => true)
31       apply_manifest(pp, :catch_changes => true)
32     end
33
34     describe file("#{basedir}/file") do
35       it { should be_file }
36       its(:content) { should match '12' }
37     end
38   end
39
40   context '=> true' do
41     pp = <<-EOS
42       concat { '#{basedir}/file':
43         ensure_newline => true,
44       }
45       concat::fragment { '1':
46         target  => '#{basedir}/file',
47         content => '1',
48       }
49       concat::fragment { '2':
50         target  => '#{basedir}/file',
51         content => '2',
52       }
53     EOS
54
55     it 'applies the manifest twice with no stderr' do
56       apply_manifest(pp, :catch_failures => true)
57       apply_manifest(pp, :catch_changes => true)
58     end
59
60     describe file("#{basedir}/file") do
61       it { should be_file }
62       its(:content) {
63         should match /1\n2\n/
64       }
65     end
66   end
67 end