1 require 'spec_helper_acceptance'
3 describe 'concat::fragment replace' do
5 @basedir = setup_test_directory
8 describe 'when run should create fragment files' do
11 concat { '#{@basedir}/foo': }
12 concat::fragment { '1':
13 target => '#{@basedir}/foo',
14 content => 'caller has replace unset run 1',
20 concat { '#{@basedir}/foo': }
21 concat::fragment { '1':
22 target => '#{@basedir}/foo',
23 content => 'caller has replace unset run 2',
28 it 'applies the manifest twice with no stderr' do
31 expect(file("#{@basedir}/foo")).to be_file
32 expect(file("#{@basedir}/foo").content).not_to match 'caller has replace unset run 1'
33 expect(file("#{@basedir}/foo").content).to match 'caller has replace unset run 2'
36 # should create fragment files
38 describe 'when run should replace its own fragment files when caller has File { replace=>true } set' do
41 File { replace=>true }
42 concat { '#{@basedir}/foo': }
43 concat::fragment { '1':
44 target => '#{@basedir}/foo',
45 content => 'caller has replace true set run 1',
51 File { replace=>true }
52 concat { '#{@basedir}/foo': }
53 concat::fragment { '1':
54 target => '#{@basedir}/foo',
55 content => 'caller has replace true set run 2',
60 it 'applies the manifest twice with no stderr' do
63 expect(file("#{@basedir}/foo")).to be_file
64 expect(file("#{@basedir}/foo").content).not_to match 'caller has replace true set run 1'
65 expect(file("#{@basedir}/foo").content).to match 'caller has replace true set run 2'
68 # should replace its own fragment files when caller has File(replace=>true) set
70 describe 'when run should replace its own fragment files even when caller has File { replace=>false } set' do
73 File { replace=>false }
74 concat { '#{@basedir}/foo': }
75 concat::fragment { '1':
76 target => '#{@basedir}/foo',
77 content => 'caller has replace false set run 1',
83 File { replace=>false }
84 concat { '#{@basedir}/foo': }
85 concat::fragment { '1':
86 target => '#{@basedir}/foo',
87 content => 'caller has replace false set run 2',
92 it 'applies the manifest twice with no stderr' do
95 expect(file("#{@basedir}/foo")).to be_file
96 expect(file("#{@basedir}/foo").content).not_to match 'caller has replace false set run 1'
97 expect(file("#{@basedir}/foo").content).to match 'caller has replace false set run 2'
100 # should replace its own fragment files even when caller has File(replace=>false) set