Class | Object |
In: |
lib/mocha/inspect.rb
lib/mocha/is_a.rb lib/mocha/metaclass.rb lib/mocha/object.rb lib/mocha/parameter_matchers/object.rb |
Parent: | Object |
Methods added all objects to allow mocking and stubbing on real objects.
Methods return a Mocha::Expectation which can be further modified by methods on Mocha::Expectation.
Adds an expectation that a method identified by symbol must be called exactly once with any parameters. Returns the new expectation which can be further modified by methods on Mocha::Expectation.
product = Product.new product.expects(:save).returns(true) assert_equal false, product.save
The original implementation of Product#save is replaced temporarily.
The original implementation of Product#save is restored at the end of the test.
Adds an expectation that a method identified by symbol may be called any number of times with any parameters. Returns the new expectation which can be further modified by methods on Mocha::Expectation.
product = Product.new product.stubs(:save).returns(true) assert_equal false, product.save
The original implementation of Product#save is replaced temporarily.
The original implementation of Product#save is restored at the end of the test.