X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fconcat%2Fspec%2Facceptance%2Fpup-1963_spec.rb;fp=3rdparty%2Fmodules%2Fconcat%2Fspec%2Facceptance%2Fpup-1963_spec.rb;h=c36fe41cd329f2008eb3c7469bd5529699d0a1a6;hb=5e197fe72fe9bf4fa5a89ee513a3ffc1ea97c8d9;hp=0000000000000000000000000000000000000000;hpb=6963202b4b62c2816655ac9532521b018fdf83bd;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/concat/spec/acceptance/pup-1963_spec.rb b/3rdparty/modules/concat/spec/acceptance/pup-1963_spec.rb new file mode 100644 index 000000000..c36fe41cd --- /dev/null +++ b/3rdparty/modules/concat/spec/acceptance/pup-1963_spec.rb @@ -0,0 +1,69 @@ +require 'spec_helper_acceptance' + +case fact('osfamily') + when 'Windows' + command = 'cmd.exe /c echo triggered' + else + command = 'echo triggered' +end + +describe 'with metaparameters' do + describe 'with subscribed resources' do + basedir = default.tmpdir('concat') + + context 'should trigger refresh' do + pp = <<-EOS + concat { "foobar": + ensure => 'present', + path => '#{basedir}/foobar', + } + + concat::fragment { 'foo': + target => 'foobar', + content => 'foo', + } + + exec { 'trigger': + path => $::path, + command => "#{command}", + subscribe => Concat['foobar'], + refreshonly => true, + } + EOS + + it 'applies the manifest twice with stdout regex' do + expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/Triggered 'refresh'/) + expect(apply_manifest(pp, :catch_changes => true).stdout).to_not match(/Triggered 'refresh'/) + end + end + end + + describe 'with resources to notify' do + basedir = default.tmpdir('concat') + context 'should notify' do + pp = <<-EOS + exec { 'trigger': + path => $::path, + command => "#{command}", + refreshonly => true, + } + + concat { "foobar": + ensure => 'present', + path => '#{basedir}/foobar', + notify => Exec['trigger'], + } + + concat::fragment { 'foo': + target => 'foobar', + content => 'foo', + } + EOS + + it 'applies the manifest twice with stdout regex' do + expect(apply_manifest(pp, :catch_failures => true).stdout).to match(/Triggered 'refresh'/) + expect(apply_manifest(pp, :catch_changes => true).stdout).to_not match(/Triggered 'refresh'/) + end + end + end +end