 <p>Mocha is a traditional mocking library very much in the JMock mould. Stubba is a separate part of Mocha that allows mocking and stubbing of methods on real (non-mock) classes. It works by moving the method of interest to one side, adding a new stubbed version of the method which delegates to a traditional mock object. You can use this mock object to set up stubbed return values or set up expectations of methods to be called. After the test completes the stubbed version of the method is removed and replaced by the original.</p> <p>for more detail with example </p> <p><a href="http://jamesmead.org/blog/2006-09-11-the-difference-between-mocks-and-stubs" rel="nofollow">http://jamesmead.org/blog/2006-09-11-the-difference-between-mocks-and-stubs</a></p>