[mocha-developer] Test errors without verification

Zach Moazeni zach.lists at gmail.com
Thu Aug 2 23:21:24 EDT 2007

If anyone else feels these pains, I've written a monkey patch (ripped  
off from Hardmock) that will ensure both the verification and the  
user's teardown at http://www.simplechatter.com/2007/8/3/mocha-and- 

Mostly posting for archiving purposes.

Thanks for the great mocking library, guys.


On Jul 26, 2007, at 5:12 AM, James Mead wrote:

> Hi Zach,
> On 26/07/07, Zach Moazeni <zach.lists at gmail.com> wrote:
>> I'm not sure if this is by design, but I've stumbled across this a
>> few times trying to debug my own tests. If an assertion fails the
>> test, and a missing mock expectation was to blame, the test's
>> failure / error messages don't give enough info.
> This is by design. In my mind a verification failure is analogous  
> to an
> assertion failure. Test::Unit does not report multiple assertion  
> failures
> per test, but reports the first failure. Failing fast seems like  
> the right
> thing to do. At that point all bets are off and there is no point in
> continuing.
> I wonder if the pain you are feeling is because you have too many  
> assertions
> and/or expectations in each test. You might find the following article
> interesting...
> http://blog.jayfields.com/2007/06/testing-one-assertion-per-test.html
> Thanks for taking the time to put a patch together, but at this  
> stage I'm
> not convinced it's the way to go.
> -- 
> James.
> http://blog.floehopper.org
> _______________________________________________
> mocha-developer mailing list
> mocha-developer at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mocha-developer

More information about the mocha-developer mailing list