Module: ChefSpec::Extensions::Chef::Resource::ClassMethods
- Defined in:
- lib/chefspec/extensions/chef/resource.rb
Instance Method Summary collapse
- #action(sym, description: nil, &block) ⇒ Object
- #allowed_actions(*actions) ⇒ Object
- #allowed_actions=(value) ⇒ Object
- #provides(name, **options, &block) ⇒ Object
-
#provides_names ⇒ Object
XXX: kind of a crappy way to find all the names of a resource.
- #resource_name(name = ::Chef::NOT_PASSED) ⇒ Object
Instance Method Details
#action(sym, description: nil, &block) ⇒ Object
147 148 149 150 |
# File 'lib/chefspec/extensions/chef/resource.rb', line 147 def action(sym, description: nil, &block) inject_actions(sym) super(sym, &block) end |
#allowed_actions(*actions) ⇒ Object
152 153 154 155 |
# File 'lib/chefspec/extensions/chef/resource.rb', line 152 def allowed_actions(*actions) inject_actions(*actions) unless actions.empty? super end |
#allowed_actions=(value) ⇒ Object
157 158 159 160 |
# File 'lib/chefspec/extensions/chef/resource.rb', line 157 def allowed_actions=(value) inject_actions(*Array(value)) super end |
#provides(name, **options, &block) ⇒ Object
141 142 143 144 145 |
# File 'lib/chefspec/extensions/chef/resource.rb', line 141 def provides(name, **, &block) provides_names << name unless provides_names.include?(name) inject_actions(*allowed_actions) super end |
#provides_names ⇒ Object
XXX: kind of a crappy way to find all the names of a resource
129 130 131 |
# File 'lib/chefspec/extensions/chef/resource.rb', line 129 def provides_names @provides_names ||= [] end |
#resource_name(name = ::Chef::NOT_PASSED) ⇒ Object
133 134 135 136 137 138 139 |
# File 'lib/chefspec/extensions/chef/resource.rb', line 133 def resource_name(name = ::Chef::NOT_PASSED) unless name == ::Chef::NOT_PASSED provides_names << name unless provides_names.include?(name) inject_actions(*allowed_actions) end super end |