1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
# frozen_string_literal: true
require 'spec_helper_acceptance'
describe 'concat ensure_newline parameter' do
attr_reader :basedir
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',
content => '1',
}
concat::fragment { '2':
target => '#{basedir}/file',
content => '2',
}
MANIFEST
end
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
describe 'when true' do
let(:pp) do
<<-MANIFEST
concat { '#{basedir}/file':
ensure_newline => true,
}
concat::fragment { '1':
target => '#{basedir}/file',
content => '1',
}
concat::fragment { '2':
target => '#{basedir}/file',
content => '2',
}
MANIFEST
end
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
|