Mocha (Not Updated)

Why?

Mocha is a library that helps isolating code when testing. It allows to redefine a method and force it to return an expected value, or add an empty method to a given class. This is mostly useful when we want to test behavior that depends on an expensive method call: if we don't care about the expensive method call, we can just stub it and do our normal testing supposing that the expensive method will return something (which we define a-priori).

Installation Steps

Step 1
Put this in your config/environments/test.rb

config.gem "mocha", :version => '0.9.8'

Step 2
Then install it:

sudo rake gems:install
rake gems:unpack GEM=mocha RAILS_ENV=test

And that's it!.

Documentation and Examples

TODO

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License