Methods added to all classes to allow mocking and stubbing on real (i.e. non-mock) objects.
@return [Mock] a mock object which will detect calls to any instance of this class. @raise [StubbingError] if attempting to stub method which is not allowed.
@example Return false to invocation of +Product#save+ for any instance of Product.
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
# File lib/mocha/object.rb, line 231 231: def any_instance 232: if frozen? 233: raise StubbingError.new("can't stub method on frozen object: #{mocha_inspect}.any_instance", caller) 234: end 235: @any_instance ||= AnyInstance.new(self) 236: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.