[mocha-developer] Test errors without verification

Zach Moazeni zach.lists at gmail.com
Wed Jul 25 23:52:07 EDT 2007


(Sorry if anyone receives duplicates, I'm not sure if the first one  
was successfully sent)

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. I've had to resort to

def teardown
   mocha_verify
end

which just gets tedious.

I've created a patch against trunk v164 and included it below.

Example:

def test_something
     mock = mock("some mock")
     mock.expects(:message)
     flunk # or fail
end

I'm expecting to get both the flunk / fail message AND the Mocha  
expectation failure.

It's a very minor change, but I'm interested in what you guys think,

-Zach


-------------- next part --------------



More information about the mocha-developer mailing list