Module Mocha::ClassMethods
In: lib/mocha/object.rb

Methods added all classes to allow mocking and stubbing on real objects.

Methods

Public Instance methods

Returns a mock object which will detect calls to any instance of this class.

  Product.any_instance.stubs(:save).returns(false)
  product_1 = Product.new
  assert_equal false, product_1.save
  product_2 = Product.new
  assert_equal false, product_2.save

[Source]

# File lib/mocha/object.rb, line 202
    def any_instance
      @any_instance ||= AnyInstance.new(self)
    end

[Validate]