1 require 'spec_helper_acceptance'
11 username = 'Administrator'
12 groupname = 'Administrators'
18 describe 'basic concat test' do
20 @basedir = setup_test_directory
23 describe 'with owner/group root' do
26 concat { '#{@basedir}/file':
27 owner => '#{username}',
28 group => '#{groupname}',
32 concat::fragment { '1':
33 target => '#{@basedir}/file',
38 concat::fragment { '2':
39 target => '#{@basedir}/file',
46 it 'idempotent, file matches' do
48 expect(file("#{@basedir}/file")).to be_file
49 expect(file("#{@basedir}/file")).to be_owned_by username unless os[:family] == 'windows'
50 expect(file("#{@basedir}/file")).to be_grouped_into groupname unless os[:family] == 'windows' || os[:family] == 'darwin'
51 expect(file("#{@basedir}/file")).to be_mode 644 unless os[:family] == 'aix' || os[:family] == 'windows'
52 expect(file("#{@basedir}/file").content).to match '1'
53 expect(file("#{@basedir}/file").content).to match '2'
57 describe 'when present with path set' do
62 path => '#{@basedir}/file',
65 concat::fragment { '1':
73 it 'idempotent, file matches' do
75 expect(file("#{@basedir}/file")).to be_file
76 expect(file("#{@basedir}/file")).to be_mode 644 unless os[:family] == 'aix' || os[:family] == 'windows'
77 expect(file("#{@basedir}/file").content).to match '1'
81 describe 'when absent with path set' do
86 path => '#{@basedir}/file',
89 concat::fragment { '1':
97 it 'applies the manifest twice with no stderr' do
99 expect(file("#{@basedir}/file")).not_to be_file
103 describe 'when present with path that has special characters' do
104 filename = (os[:family] == 'windows') ? 'file(1)' : 'file(1:2)'
108 concat { '#{filename}':
110 path => '#{@basedir}/#{filename}',
113 concat::fragment { '1':
114 target => '#{filename}',
121 it 'idempotent, file matches' do
123 expect(file("#{@basedir}/#{filename}")).to be_file
124 expect(file("#{@basedir}/#{filename}")).to be_mode 644 unless os[:family] == 'aix' || os[:family] == 'windows'
125 expect(file("#{@basedir}/#{filename}").content).to match '1'
129 describe 'with noop properly' do
134 path => '#{@basedir}/file',
138 concat::fragment { '1':
146 it 'applies manifest twice with no stderr' do
148 expect(file("#{@basedir}/file")).not_to be_file