+ before(:all) do
+ pp = <<-EOS
+ file { '#{basedir}':
+ ensure => directory,
+ }
+ file { '#{basedir}/file1':
+ content => "file1 contents\n",
+ }
+ EOS
+ apply_manifest(pp)
+ end
+
+ pp = <<-EOS
+ concat { '#{basedir}/file': }
+ concat::fragment { 'foo':
+ target => '#{basedir}/file',
+ ensure => '#{basedir}/file1',
+ }
+ EOS
+ w = 'Passing a value other than \'present\' or \'absent\' as the $ensure parameter to concat::fragment is deprecated. If you want to use the content of a file as a fragment please use the $source parameter.'
+
+ it_behaves_like 'has_warning', pp, w
+
+ describe file("#{basedir}/file") do
+ it { should be_file }
+ its(:content) { should match 'file1 contents' }
+ end
+
+ describe 'the fragment can be changed from a symlink to a plain file', :unless => (fact("osfamily") == "windows") do
+ pp = <<-EOS
+ concat { '#{basedir}/file': }
+ concat::fragment { 'foo':
+ target => '#{basedir}/file',
+ content => 'new content',
+ }
+ 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 'new content'
+ should_not match 'file1 contents'
+ }
+ end
+ end
+ end # target file exists
+
+ context 'target does not exist', :unless => fact('osfamily') == 'windows' do
+ pp = <<-EOS
+ concat { '#{basedir}/file': }
+ concat::fragment { 'foo':
+ target => '#{basedir}/file',
+ ensure => '#{basedir}/file1',
+ }
+ EOS
+ w = 'Passing a value other than \'present\' or \'absent\' as the $ensure parameter to concat::fragment is deprecated. If you want to use the content of a file as a fragment please use the $source parameter.'
+
+ it_behaves_like 'has_warning', pp, w
+
+ describe file("#{basedir}/file") do
+ it { should be_file }
+ end
+
+ describe 'the fragment can be changed from a symlink to a plain file', :unless => (fact('osfamily') == 'windows') do
+ pp = <<-EOS
+ concat { '#{basedir}/file': }
+ concat::fragment { 'foo':
+ target => '#{basedir}/file',
+ content => 'new content',
+ }
+ 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 'new content' }
+ end
+ end
+ end # target file exists
+
+ end # concat::fragment ensure parameter
+
+ context 'concat::fragment mode parameter' do