1 require 'spec_helper_acceptance'
7 scriptname = 'concatfragments.rb'
8 vardir = default['puppetvardir']
12 scriptname = 'concatfragments.rb'
13 vardir = default['puppetvardir']
15 username = 'Administrator'
16 groupname = 'Administrators'
17 scriptname = 'concatfragments.rb'
18 result = on default, "echo #{default['puppetvardir']}"
19 vardir = result.raw_output.chomp
23 scriptname = 'concatfragments.rb'
24 vardir = default['puppetvardir']
28 scriptname = 'concatfragments.rb'
29 vardir = default['puppetvardir']
32 describe 'basic concat test' do
33 basedir = default.tmpdir('concat')
34 safe_basedir = basedir.gsub(/[\/:]/, '_')
36 shared_examples 'successfully_applied' do |pp|
37 it 'applies the manifest twice with no stderr' do
38 apply_manifest(pp, :catch_failures => true)
39 apply_manifest(pp, :catch_changes => true)
43 context 'owner/group root' do
53 concat { '#{basedir}/file':
54 owner => '#{username}',
55 group => '#{groupname}',
59 concat::fragment { '1':
60 target => '#{basedir}/file',
65 concat::fragment { '2':
66 target => '#{basedir}/file',
72 it_behaves_like 'successfully_applied', pp
74 describe file("#{basedir}/file") do
76 it { should be_owned_by username }
77 it("should be group", :unless => (fact('osfamily') == 'windows')) { should be_grouped_into groupname }
78 it("should be mode", :unless => (fact('osfamily') == 'AIX' or fact('osfamily') == 'windows')) {
89 context 'works when set to present with path set' do
101 path => '#{basedir}/file',
104 concat::fragment { '1':
111 it_behaves_like 'successfully_applied', pp
113 describe file("#{basedir}/file") do
114 it { should be_file }
115 it("should be mode", :unless => (fact('osfamily') == 'AIX' or fact('osfamily') == 'windows')) {
118 its(:content) { should match '1' }
121 context 'works when set to absent with path set' do
133 path => '#{basedir}/file',
136 concat::fragment { '1':
143 it 'applies the manifest twice with no stderr' do
144 apply_manifest(pp, :catch_failures => true)
145 apply_manifest(pp, :catch_changes => true)
148 describe file("#{basedir}/file") do
149 it { should_not be_file }