Module: ChefSpec::Extensions::Chef::Resource::ClassMethods

Defined in:
lib/chefspec/extensions/chef/resource.rb

Instance Method Summary collapse

Instance Method Details

#action(sym, &block) ⇒ Object


96
97
98
99
# File 'lib/chefspec/extensions/chef/resource.rb', line 96

def action(sym, &block)
  inject_actions(sym)
  super
end

#allowed_actions(*actions) ⇒ Object


101
102
103
104
# File 'lib/chefspec/extensions/chef/resource.rb', line 101

def allowed_actions(*actions)
  inject_actions(*actions) unless actions.empty?
  super
end

#allowed_actions=(value) ⇒ Object


106
107
108
109
# File 'lib/chefspec/extensions/chef/resource.rb', line 106

def allowed_actions=(value)
  inject_actions(*Array(value))
  super
end

#provides(name, *args, &block) ⇒ Object


90
91
92
93
94
# File 'lib/chefspec/extensions/chef/resource.rb', line 90

def provides(name, *args, &block)
  provides_names << name unless provides_names.include?(name)
  inject_actions(*allowed_actions)
  super
end

#provides_namesObject

XXX: kind of a crappy way to find all the names of a resource


78
79
80
# File 'lib/chefspec/extensions/chef/resource.rb', line 78

def provides_names
  @provides_names ||= []
end

#resource_name(name = ::Chef::NOT_PASSED) ⇒ Object


82
83
84
85
86
87
88
# File 'lib/chefspec/extensions/chef/resource.rb', line 82

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