warn_spec.rb 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. require 'spec_helper_acceptance'
  2. describe 'concat warn =>' do
  3. basedir = default.tmpdir('concat')
  4. context 'true should enable default warning message' do
  5. pp = <<-EOS
  6. concat { '#{basedir}/file':
  7. warn => true,
  8. }
  9. concat::fragment { '1':
  10. target => '#{basedir}/file',
  11. content => '1',
  12. order => '01',
  13. }
  14. concat::fragment { '2':
  15. target => '#{basedir}/file',
  16. content => '2',
  17. order => '02',
  18. }
  19. EOS
  20. it 'applies the manifest twice with no stderr' do
  21. apply_manifest(pp, :catch_failures => true)
  22. apply_manifest(pp, :catch_changes => true)
  23. end
  24. describe file("#{basedir}/file") do
  25. it { should be_file }
  26. it { should contain '# This file is managed by Puppet. DO NOT EDIT.' }
  27. it { should contain '1' }
  28. it { should contain '2' }
  29. end
  30. end
  31. context 'false should not enable default warning message' do
  32. pp = <<-EOS
  33. concat { '#{basedir}/file':
  34. warn => false,
  35. }
  36. concat::fragment { '1':
  37. target => '#{basedir}/file',
  38. content => '1',
  39. order => '01',
  40. }
  41. concat::fragment { '2':
  42. target => '#{basedir}/file',
  43. content => '2',
  44. order => '02',
  45. }
  46. EOS
  47. it 'applies the manifest twice with no stderr' do
  48. apply_manifest(pp, :catch_failures => true)
  49. apply_manifest(pp, :catch_changes => true)
  50. end
  51. describe file("#{basedir}/file") do
  52. it { should be_file }
  53. it { should_not contain '# This file is managed by Puppet. DO NOT EDIT.' }
  54. it { should contain '1' }
  55. it { should contain '2' }
  56. end
  57. end
  58. context '# foo should overide default warning message' do
  59. pp = <<-EOS
  60. concat { '#{basedir}/file':
  61. warn => '# foo',
  62. }
  63. concat::fragment { '1':
  64. target => '#{basedir}/file',
  65. content => '1',
  66. order => '01',
  67. }
  68. concat::fragment { '2':
  69. target => '#{basedir}/file',
  70. content => '2',
  71. order => '02',
  72. }
  73. EOS
  74. it 'applies the manifest twice with no stderr' do
  75. apply_manifest(pp, :catch_failures => true)
  76. apply_manifest(pp, :catch_changes => true)
  77. end
  78. describe file("#{basedir}/file") do
  79. it { should be_file }
  80. it { should contain '# foo' }
  81. it { should contain '1' }
  82. it { should contain '2' }
  83. end
  84. end
  85. end