X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fconcat%2Fspec%2Facceptance%2Fwarn_header_spec.rb;fp=3rdparty%2Fmodules%2Fconcat%2Fspec%2Facceptance%2Fwarn_header_spec.rb;h=b73414e34052b47f163980b464beb98dbc581a5d;hb=5e197fe72fe9bf4fa5a89ee513a3ffc1ea97c8d9;hp=0000000000000000000000000000000000000000;hpb=6963202b4b62c2816655ac9532521b018fdf83bd;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/concat/spec/acceptance/warn_header_spec.rb b/3rdparty/modules/concat/spec/acceptance/warn_header_spec.rb new file mode 100644 index 000000000..b73414e34 --- /dev/null +++ b/3rdparty/modules/concat/spec/acceptance/warn_header_spec.rb @@ -0,0 +1,104 @@ +require 'spec_helper_acceptance' + +describe 'concat warn =>' do + basedir = default.tmpdir('concat') + context 'true should enable default warning message' do + pp = <<-EOS + concat { '#{basedir}/file': + warn => true, + } + + concat::fragment { '1': + target => '#{basedir}/file', + content => '1', + order => '01', + } + + concat::fragment { '2': + target => '#{basedir}/file', + content => '2', + order => '02', + } + EOS + + it 'applies the manifest twice with no stderr' do + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + + describe file("#{basedir}/file") do + it { should be_file } + its(:content) { + should match /# This file is managed by Puppet\. DO NOT EDIT\./ + should match /1/ + should match /2/ + } + end + end + context 'false should not enable default warning message' do + pp = <<-EOS + concat { '#{basedir}/file': + warn => false, + } + + concat::fragment { '1': + target => '#{basedir}/file', + content => '1', + order => '01', + } + + concat::fragment { '2': + target => '#{basedir}/file', + content => '2', + order => '02', + } + EOS + + it 'applies the manifest twice with no stderr' do + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + + describe file("#{basedir}/file") do + it { should be_file } + its(:content) { + should_not match /# This file is managed by Puppet\. DO NOT EDIT\./ + should match /1/ + should match /2/ + } + end + end + context '# foo should overide default warning message' do + pp = <<-EOS + concat { '#{basedir}/file': + warn => "# foo\n", + } + + concat::fragment { '1': + target => '#{basedir}/file', + content => '1', + order => '01', + } + + concat::fragment { '2': + target => '#{basedir}/file', + content => '2', + order => '02', + } + EOS + + it 'applies the manifest twice with no stderr' do + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + + describe file("#{basedir}/file") do + it { should be_file } + its(:content) { + should match /# foo/ + should match /1/ + should match /2/ + } + end + end +end