# Mocha - new stubbing and mocking library released

**URL:** <https://www.ruby-forum.com/t/mocha-new-stubbing-and-mocking-library-released/98984>\
**Category:** Ruby\
**Created:** [July 19, 2006, 3:56pm UTC](https://www.ruby-forum.com/t/mocha-new-stubbing-and-mocking-library-released/98984 "2006-07-19T15:56:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![noagenda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/8c91f0/32.png) [@noagenda](https://www.ruby-forum.com/u/noagenda)\
**Post date:** [July 19, 2006, 3:56pm UTC](https://www.ruby-forum.com/t/mocha-new-stubbing-and-mocking-library-released/98984/1 "2006-07-19T15:56:11Z")

</div>

Mocha is a Ruby mocking library with a syntax like that of JMock and  
SchMock, but with a couple of useful extras. It comes in three parts:

Mocha - traditional mock objects with expectations and verification  
Stubba - allows mocking and stubbing of methods on real (non-mock)  
classes and instances  
AutoMocha - magically provides mocks in the place of undefined classes

RDoc - [http://mocha.rubyforge.org](http://mocha.rubyforge.org)  
Download - [http://rubyforge.org/projects/mocha](http://rubyforge.org/projects/mocha)

Mocha and Stubba have been created by amalgamating a number of  
techniques developed by me and my Reevoo colleagues (Ben G.,  
Chris R. and Paul B.) into a common syntax. Both Mocha and  
Stubba are in use on real-world Rails projects.

AutoMocha is more experimental and is at an earlier stage of  
development. It’s an attempt to make it easier to write true unit  
tests (i.e. tests with no external dependencies).

You can find examples in the RDoc README and in the acceptance tests.

James

> **[James Mead](https://jamesmead.org/)**
>
> Ruby Developer, author of Mocha, and ex-Antarctic Hero.
