module Mocha::ClassMethods

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