[mocha-developer] how to test timeouts? that #returns deprecation again...

James Mead jamesmead44 at gmail.com
Fri Mar 28 12:13:21 EDT 2008


I just found this old reply sitting in my drafts folder. I don't know if
it's any use, but...

Hmm. I don't like having multiple threads knocking around in my unit tests
> (see http://www.jmock.org/threads.html - although its examples are in
> Java, don't be put off - they are very readable).
>
> In this case you are really testing two things - firstly that you are
> wrapping the call with a timeout and secondly that the timeout is working
> correctly. I would suggest that the second issue is testing third party code
> that you should be able to rely on (and ideally should have its own tests).
> So in order to test the first issue, you could set up an expectation for the
> call to Timeout::timeout. Unfortunately there isn't currently a nice way to
> check that you are passing in the correct block to the timeout method.
>
> I'm going to mention this to James Adam (one of the other developers at
> Reevoo) who ran into a similar issue a while ago - he might be able to help.
> --
> James.
> http://blog.floehopper.org
> http://tumble.floehopper.org
>


More information about the mocha-developer mailing list