module ChefSpec::Extensions::Chef::Resource
def initialize(*args, &block)
Hooks for the stubs_for system
def initialize(*args, &block) super(*args, &block) if $CHEFSPEC_MODE # Here be dragons. # If we're directly inside a `load_current_resource`, this is probably # something like `new_resource.class.new` so we want to call this a current_resource, # Otherwise it's probably a normal resource instantiation. mode = :resource mode = :current_value if caller.any? { |x| x.include?("`load_current_resource'") || x.include?("`load_after_resource'") } ChefSpec::API::StubsFor.setup_stubs_for(self, mode) end end