summaryrefslogtreecommitdiff
path: root/spec/classes/anchor_spec.rb
blob: 2dd17de9ad40e1403b742ad9d48cbb4e0f188f96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require 'puppet'
require 'rspec-puppet'

describe "anchorrefresh" do
  let(:node) { 'testhost.example.com' }
  let :pre_condition do
    <<-ANCHORCLASS
class anchored {
  anchor { 'anchored::begin': }
  ~> anchor { 'anchored::end': }
}

class anchorrefresh {
  notify { 'first': }
  ~> class { 'anchored': }
  ~> anchor { 'final': }
}
    ANCHORCLASS
  end

  def apply_catalog_and_return_exec_rsrc
    catalog = subject.to_ral
    transaction = catalog.apply
    transaction.resource_status("Anchor[final]")
  end

  it 'propagates events through the anchored class' do
    resource = apply_catalog_and_return_exec_rsrc

    expect(resource.restarted).to eq(true)
  end
end