module Mocha::ClassMethods

def __method_visibility__(method, include_public_methods = true)

Other tags:
    Private: -
def __method_visibility__(method, include_public_methods = true)
  (include_public_methods && public_method_defined?(method) && :public) ||
    (protected_method_defined?(method) && :protected) ||
    (private_method_defined?(method) && :private)
end

def any_instance

Other tags:
    Example: Return false to invocation of +Product#save+ for any instance of +Product+. -

Raises:
  • (StubbingError) - if attempting to stub method which is not allowed.

Returns:
  • (Mock) - a mock object which will detect calls to any instance of this class.
def any_instance
  if frozen?
    raise StubbingError.new("can't stub method on frozen object: #{mocha_inspect}.any_instance", caller)
  end
  @any_instance ||= AnyInstance.new(self)
end