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.
75 76 77 78 79 80 81 |
# File 'lib/poise/helpers/chefspec_matchers.rb', line 75 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.
67 68 69 70 |
# File 'lib/poise/helpers/chefspec_matchers.rb', line 67 def provides(name) ChefSpec.define_matcher(name) if defined?(ChefSpec) super end |