concat_setup_spec.rb 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. require 'spec_helper'
  2. describe 'concat::setup', :type => :class do
  3. shared_examples 'setup' do |concatdir|
  4. concatdir = '/foo' if concatdir.nil?
  5. let(:facts) do
  6. {
  7. :concat_basedir => concatdir,
  8. :caller_module_name => 'Test',
  9. :osfamily => 'Debian',
  10. :id => 'root',
  11. :is_pe => false,
  12. }
  13. end
  14. it do
  15. should contain_file("#{concatdir}/bin/concatfragments.rb").with({
  16. :mode => '0755',
  17. :source => 'puppet:///modules/concat/concatfragments.rb',
  18. :backup => false,
  19. })
  20. end
  21. [concatdir, "#{concatdir}/bin"].each do |file|
  22. it do
  23. should contain_file(file).with({
  24. :ensure => 'directory',
  25. :mode => '0755',
  26. :backup => false,
  27. })
  28. end
  29. end
  30. end
  31. context 'facts' do
  32. context 'concat_basedir =>' do
  33. context '/foo' do
  34. it_behaves_like 'setup', '/foo'
  35. end
  36. end
  37. end # facts
  38. context 'deprecated as a public class' do
  39. it 'should create a warning' do
  40. skip('rspec-puppet support for testing warning()')
  41. end
  42. end
  43. context "on osfamily Solaris" do
  44. concatdir = '/foo'
  45. let(:facts) do
  46. {
  47. :concat_basedir => concatdir,
  48. :caller_module_name => 'Test',
  49. :osfamily => 'Solaris',
  50. :id => 'root',
  51. :is_pe => false,
  52. }
  53. end
  54. it do
  55. should contain_file("#{concatdir}/bin/concatfragments.rb").with({
  56. :ensure => 'file',
  57. :owner => 'root',
  58. :mode => '0755',
  59. :source => 'puppet:///modules/concat/concatfragments.rb',
  60. :backup => false,
  61. })
  62. end
  63. end # on osfamily Solaris
  64. context "on osfamily windows" do
  65. concatdir = '/foo'
  66. let(:facts) do
  67. {
  68. :concat_basedir => concatdir,
  69. :caller_module_name => 'Test',
  70. :osfamily => 'windows',
  71. :id => 'batman',
  72. :is_pe => false,
  73. }
  74. end
  75. it do
  76. should contain_file("#{concatdir}/bin/concatfragments.rb").with({
  77. :ensure => 'file',
  78. :owner => nil,
  79. :mode => nil,
  80. :source => 'puppet:///modules/concat/concatfragments.rb',
  81. :backup => false,
  82. })
  83. end
  84. end # on osfamily windows
  85. end