anchor_spec.rb 675 B

1234567891011121314151617181920212223242526272829303132
  1. require 'puppet'
  2. require 'rspec-puppet'
  3. describe "anchorrefresh" do
  4. let(:node) { 'testhost.example.com' }
  5. let :pre_condition do
  6. <<-ANCHORCLASS
  7. class anchored {
  8. anchor { 'anchored::begin': }
  9. ~> anchor { 'anchored::end': }
  10. }
  11. class anchorrefresh {
  12. notify { 'first': }
  13. ~> class { 'anchored': }
  14. ~> anchor { 'final': }
  15. }
  16. ANCHORCLASS
  17. end
  18. def apply_catalog_and_return_exec_rsrc
  19. catalog = subject.to_ral
  20. transaction = catalog.apply
  21. transaction.resource_status("Anchor[final]")
  22. end
  23. it 'propagates events through the anchored class' do
  24. resource = apply_catalog_and_return_exec_rsrc
  25. expect(resource.restarted).to eq(true)
  26. end
  27. end