Module: Mocha::ClassMethods

Included in:
Class
Defined in:
lib/mocha/object.rb

Overview

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

Defined Under Namespace

Classes: AnyInstance

Instance Method Summary collapse

Instance Method Details

#any_instanceObject

:call-seq: any_instance -> mock object

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


169
170
171
# File 'lib/mocha/object.rb', line 169

def any_instance
  @any_instance ||= AnyInstance.new(self)
end

#stubba_methodObject

:nodoc:



128
129
130
# File 'lib/mocha/object.rb', line 128

def stubba_method # :nodoc:
  Mocha::ClassMethod
end