Update stdlib and concat to 6.1.0 both
[mirror/dsa-puppet.git] / 3rdparty / modules / concat / spec / acceptance / order_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'concat order' do
4   before(:all) do
5     @basedir = setup_test_directory
6   end
7   describe 'sortby alpha' do
8     let(:pp) do
9       <<-MANIFEST
10       concat { '#{@basedir}/foo':
11         order => 'alpha'
12       }
13       concat::fragment { '1':
14         target  => '#{@basedir}/foo',
15         content => 'string1',
16         order   => '1',
17       }
18       concat::fragment { '2':
19         target  => '#{@basedir}/foo',
20         content => 'string2',
21         order   => '2',
22       }
23       concat::fragment { '10':
24         target  => '#{@basedir}/foo',
25         content => 'string10',
26       }
27       MANIFEST
28     end
29
30     it 'applies the manifest twice with no stderr' do
31       idempotent_apply(pp)
32       expect(file("#{@basedir}/foo")).to be_file
33       expect(file("#{@basedir}/foo").content).to match %r{string1string10string2}
34     end
35   end
36
37   describe 'sortby numeric' do
38     let(:pp) do
39       <<-MANIFEST
40       concat { '#{@basedir}/foo':
41         order => 'numeric'
42       }
43       concat::fragment { '1':
44         target  => '#{@basedir}/foo',
45         content => 'string1',
46         order   => '1',
47       }
48       concat::fragment { '2':
49         target  => '#{@basedir}/foo',
50         content => 'string2',
51         order   => '2',
52       }
53       concat::fragment { '10':
54         target  => '#{@basedir}/foo',
55         content => 'string10',
56       }
57       MANIFEST
58     end
59
60     it 'applies the manifest twice with no stderr' do
61       idempotent_apply(pp)
62       expect(file("#{@basedir}/foo")).to be_file
63       expect(file("#{@basedir}/foo").content).to match %r{string1string2string10}
64     end
65   end
66 end