[rspec-users] Assertions for asynchronous behaviour

Alex Chaffee alex at stinky.com
Tue Sep 27 20:09:42 EDT 2011


After a week of stealing minutes, I eventually wrote eventually!
Please check this out and give me feedback. I can ship it in a new
Wrong gem as soon as you all tell me it's ready.

docs:
https://github.com/alexch/wrong/commit/cae852f09a3d4dcb3f014b486a10d5eb7a10e7f5

test (spec):
https://github.com/alexch/wrong/blob/master/test/eventually_test.rb

code:
https://github.com/alexch/wrong/blob/master/lib/wrong/eventually.rb

The only major feature I haven't done is editing the error message
from inside the block, since Wrong seems to do a good job of this on
its own. If the block contains a "should" or a Wrong "assert" then it
ends up looking like it just got called and failed the final time.
It'd be nice if I could sneak into an exception and append "(after 5
sec)" to e.message but I don't know if I want to go there...

-- 
Alex Chaffee - alex at stinky.com
http://alexchaffee.com
http://twitter.com/alexch


More information about the rspec-users mailing list