require 'spec_helper_acceptance'
describe 'warnings' do
- basedir = default.tmpdir('concat')
-
- shared_examples 'has_warning' do |pp, w|
- it 'applies the manifest twice with a stderr regex' do
- expect(apply_manifest(pp, :catch_failures => true).stderr).to match(/#{Regexp.escape(w)}/m)
- expect(apply_manifest(pp, :catch_changes => true).stderr).to match(/#{Regexp.escape(w)}/m)
- end
+ before(:all) do
+ @basedir = setup_test_directory
end
- context 'concat::fragment target not found' do
- context 'target not found' do
- pp = <<-EOS
+ context 'when concat::fragment target not found' do
+ let(:pp) do
+ <<-MANIFEST
concat { 'file':
- path => '#{basedir}/file',
+ path => '#{@basedir}/file',
}
concat::fragment { 'foo':
- target => '#{basedir}/bar',
+ target => '#{@basedir}/bar',
content => 'bar',
}
- EOS
- w = 'not found in the catalog'
+ MANIFEST
+ end
- it_behaves_like 'has_warning', pp, w
+ it 'applies manifests, check stderr' do
+ expect(apply_manifest(pp, expect_failures: true).stderr).to match 'not found in the catalog'
+ expect(apply_manifest(pp, expect_failures: true).stderr).to match 'not found in the catalog'
end
end
end