X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fdsa-puppet.git;a=blobdiff_plain;f=3rdparty%2Fmodules%2Fconcat%2Fspec%2Facceptance%2Fnewline_spec.rb;h=7a8bfdf4e64b60f051ae1d1472774f0dc1a9aa22;hp=c1fa16a10131e9bdbeea2dce2c5c41cc1046f588;hb=30caaa85aed7015ca0d77216bff175eebd917eb7;hpb=6f656bd4265e3dab13b9af2bf96e9044322e9d8f diff --git a/3rdparty/modules/concat/spec/acceptance/newline_spec.rb b/3rdparty/modules/concat/spec/acceptance/newline_spec.rb index c1fa16a10..7a8bfdf4e 100644 --- a/3rdparty/modules/concat/spec/acceptance/newline_spec.rb +++ b/3rdparty/modules/concat/spec/acceptance/newline_spec.rb @@ -1,67 +1,54 @@ require 'spec_helper_acceptance' describe 'concat ensure_newline parameter' do - basedir = default.tmpdir('concat') - context '=> false' do - before(:all) do - pp = <<-EOS - file { '#{basedir}': - ensure => directory - } - EOS - - apply_manifest(pp) - end - pp = <<-EOS - concat { '#{basedir}/file': + before(:all) do + @basedir = setup_test_directory + end + describe 'when false' do + let(:pp) do + <<-MANIFEST + concat { '#{@basedir}/file': ensure_newline => false, } concat::fragment { '1': - target => '#{basedir}/file', + target => '#{@basedir}/file', content => '1', } concat::fragment { '2': - target => '#{basedir}/file', + target => '#{@basedir}/file', content => '2', } - EOS - - it 'applies the manifest twice with no stderr' do - apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + MANIFEST end - describe file("#{basedir}/file") do - it { should be_file } - its(:content) { should match '12' } + it 'applies the manifest twice with no stderr' do + idempotent_apply(pp) + expect(file("#{@basedir}/file")).to be_file + expect(file("#{@basedir}/file").content).to match '12' end end - context '=> true' do - pp = <<-EOS - concat { '#{basedir}/file': + describe 'when true' do + let(:pp) do + <<-MANIFEST + concat { '#{@basedir}/file': ensure_newline => true, } concat::fragment { '1': - target => '#{basedir}/file', + target => '#{@basedir}/file', content => '1', } concat::fragment { '2': - target => '#{basedir}/file', + target => '#{@basedir}/file', content => '2', } - EOS - - it 'applies the manifest twice with no stderr' do - apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + MANIFEST end - describe file("#{basedir}/file") do - it { should be_file } - its(:content) { - should match /1\n2\n/ - } + it 'applies the manifest twice with no stderr' do + idempotent_apply(pp) + expect(file("#{@basedir}/file")).to be_file + expect(file("#{@basedir}/file").content).to match %r{1\r?\n2\r?\n} end end end