2014-01-15 20:16:49 +01:00
|
|
|
require 'spec_helper_acceptance'
|
|
|
|
|
|
|
|
describe 'concat ensure_newline parameter' do
|
2014-02-28 00:50:18 +01:00
|
|
|
basedir = default.tmpdir('concat')
|
2014-01-15 20:16:49 +01:00
|
|
|
context '=> false' do
|
|
|
|
pp = <<-EOS
|
2014-02-12 22:41:41 +01:00
|
|
|
include concat::setup
|
2014-02-27 23:52:53 +01:00
|
|
|
concat { '#{basedir}/file':
|
2014-01-15 20:16:49 +01:00
|
|
|
ensure_newline => false,
|
|
|
|
}
|
|
|
|
concat::fragment { '1':
|
2014-02-27 23:52:53 +01:00
|
|
|
target => '#{basedir}/file',
|
2014-01-15 20:16:49 +01:00
|
|
|
content => '1',
|
|
|
|
}
|
|
|
|
concat::fragment { '2':
|
2014-02-27 23:52:53 +01:00
|
|
|
target => '#{basedir}/file',
|
2014-01-15 20:16:49 +01:00
|
|
|
content => '2',
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
|
|
|
|
it 'applies the manifest twice with no stderr' do
|
2014-09-08 21:01:30 +02:00
|
|
|
apply_manifest(pp, :catch_failures => true)
|
|
|
|
apply_manifest(pp, :catch_changes => true)
|
2014-01-15 20:16:49 +01:00
|
|
|
end
|
|
|
|
|
2014-02-27 23:52:53 +01:00
|
|
|
describe file("#{basedir}/file") do
|
2014-01-15 20:16:49 +01:00
|
|
|
it { should be_file }
|
|
|
|
it { should contain '12' }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context '=> true' do
|
|
|
|
pp = <<-EOS
|
2014-09-10 21:03:35 +02:00
|
|
|
concat { '#{basedir}/file':
|
2014-01-15 20:16:49 +01:00
|
|
|
ensure_newline => true,
|
|
|
|
}
|
|
|
|
concat::fragment { '1':
|
2014-09-10 21:03:35 +02:00
|
|
|
target => '#{basedir}/file',
|
2014-01-15 20:16:49 +01:00
|
|
|
content => '1',
|
|
|
|
}
|
|
|
|
concat::fragment { '2':
|
2014-09-10 21:03:35 +02:00
|
|
|
target => '#{basedir}/file',
|
2014-01-15 20:16:49 +01:00
|
|
|
content => '2',
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
|
|
|
|
it 'applies the manifest twice with no stderr' do
|
2014-09-08 21:01:30 +02:00
|
|
|
apply_manifest(pp, :catch_failures => true)
|
|
|
|
apply_manifest(pp, :catch_changes => true)
|
2014-01-15 20:16:49 +01:00
|
|
|
end
|
|
|
|
|
2014-09-10 21:03:35 +02:00
|
|
|
describe file('#{basedir}/file') do
|
2014-01-15 20:16:49 +01:00
|
|
|
it { should be_file }
|
|
|
|
it { should contain "1\n2\n" }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|