]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/concat/spec/acceptance/order_spec.rb
try if downgrading to 1.2.2 solves my problem
[dsa-puppet.git] / 3rdparty / modules / concat / spec / acceptance / order_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'concat order' do
4   basedir = default.tmpdir('concat')
5
6   context '=> ' do
7     shared_examples 'sortby' do |order_by, match_output|
8       pp = <<-EOS
9       concat { '#{basedir}/foo':
10         order => '#{order_by}'
11       }
12       concat::fragment { '1':
13         target  => '#{basedir}/foo',
14         content => 'string1',
15         order   => '1',
16       }
17       concat::fragment { '2':
18         target  => '#{basedir}/foo',
19         content => 'string2',
20         order   => '2',
21       }
22       concat::fragment { '10':
23         target  => '#{basedir}/foo',
24         content => 'string10',
25       }
26       EOS
27
28       it 'applies the manifest twice with no stderr' do
29         apply_manifest(pp, :catch_failures => true)
30         apply_manifest(pp, :catch_changes => true)
31       end
32
33       describe file("#{basedir}/foo") do
34         it { should be_file }
35         its(:content) { should match match_output }
36       end
37     end
38
39     describe 'alpha' do
40       it_behaves_like 'sortby', 'alpha', /string10string1string2/
41     end
42
43     describe 'numeric' do
44       it_behaves_like 'sortby', 'numeric', /string1string2string10/
45     end
46   end
47 end # concat order
48
49 describe 'concat::fragment order' do
50   basedir = default.tmpdir('concat')
51
52   context '=> reverse order' do
53     shared_examples 'order_by' do |order_by, match_output|
54       pp = <<-EOS
55       concat { '#{basedir}/foo':
56           order => '#{order_by}'
57       }
58       concat::fragment { '1':
59         target  => '#{basedir}/foo',
60         content => 'string1',
61         order   => '15',
62       }
63       concat::fragment { '2':
64         target  => '#{basedir}/foo',
65         content => 'string2',
66         # default order 10
67       }
68       concat::fragment { '3':
69         target  => '#{basedir}/foo',
70         content => 'string3',
71         order   => '1',
72       }
73       EOS
74
75       it 'applies the manifest twice with no stderr' do
76         apply_manifest(pp, :catch_failures => true)
77         apply_manifest(pp, :catch_changes => true)
78       end
79
80       describe file("#{basedir}/foo") do
81         it { should be_file }
82         its(:content) { should match match_output }
83       end
84     end
85     describe 'alpha' do
86       it_should_behave_like 'order_by', 'alpha', /string2string1string3/
87     end
88     describe 'numeric' do
89       it_should_behave_like 'order_by', 'numeric', /string3string2string1/
90     end
91   end
92
93   context '=> normal order' do
94     pp = <<-EOS
95       concat { '#{basedir}/foo': }
96       concat::fragment { '1':
97         target  => '#{basedir}/foo',
98         content => 'string1',
99         order   => '01',
100       }
101       concat::fragment { '2':
102         target  => '#{basedir}/foo',
103         content => 'string2',
104         order   => '02'
105       }
106       concat::fragment { '3':
107         target  => '#{basedir}/foo',
108         content => 'string3',
109         order   => '03',
110       }
111     EOS
112
113     it 'applies the manifest twice with no stderr' do
114       apply_manifest(pp, :catch_failures => true)
115       apply_manifest(pp, :catch_changes => true)
116     end
117
118     describe file("#{basedir}/foo") do
119       it { should be_file }
120       its(:content) { should match /string1string2string3/ }
121     end
122   end
123 end # concat::fragment order