Module: Poise::Helpers::ChefspecMatchers
- Includes:
- LWRPPolyfill::Resource, ResourceName
- Included in:
- Resource
- Defined in:
- lib/poise/helpers/chefspec_matchers.rb
Overview
A resource mixin to register ChefSpec matchers for a resource automatically.
If you are using the provides() form for naming resources, ensure that is set before declaring actions.
Class Method Summary collapse
-
.actions(*names) ⇒ Object
Create matchers for all declared actions.
-
.provides(name) ⇒ Object
Create a resource-level matcher for this resource.
Methods included from ResourceName
Methods included from LWRPPolyfill::Resource
attribute, default_action, #initialize
Class Method Details
.actions(*names) ⇒ Object
Create matchers for all declared actions.
71 72 73 74 75 76 77 |
# File 'lib/poise/helpers/chefspec_matchers.rb', line 71 def actions(*names) super.tap do |actions| actions.each do |action| ChefspecMatchers.create_matcher(resource_name, action) end end end |
.provides(name) ⇒ Object
Create a resource-level matcher for this resource.
63 64 65 66 |
# File 'lib/poise/helpers/chefspec_matchers.rb', line 63 def provides(name) ChefSpec.define_matcher(name) if defined?(ChefSpec) super end |