Skip to content

Instantly share code, notes, and snippets.

@dblessing
Created January 3, 2015 20:31
Show Gist options
  • Save dblessing/6bc6c00fcf81f3963c05 to your computer and use it in GitHub Desktop.
Save dblessing/6bc6c00fcf81f3963c05 to your computer and use it in GitHub Desktop.
# Assuming
template '/etc/foo' do
notifies :restart, 'service[apache2]'
end
# I can do this in ChefSpec
resource = chef_run.template('/etc/foo')
expect(resource).to notify('service[apache2]').to(:restart).delayed
# Now, if I create a custom LWRP and have this:
custom_lwrp 'thing1' do
notifies :restart, 'service[apache2]'
end
# How can I test that notification? This doesn't work:
resource = chef_run.custom_lwrp('thing1')
expect(resource).to notify('service[apache2]').to(:restart).delayed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment