[rspec-users] Assertions for asynchronous behaviour

Sidu Ponnappa
Tue, 13 Sep 2011 17:06:39 -0000

> the_object.should eventually_call(:foo).within(2).seconds
TDDing multithreaded apps. Good times.

Best,
Sidu.
http://blog.sidu.in

On 13 September 2011 20:08, Justin Ko <jko170 at gmail.com>
wrote:
>
>
> On Tue, Sep 13, 2011 at 6:56 AM, Matt Wynne <matt at mattwynne.net>
wrote:
>>
>> Hi all,
>> In GOOS[1] they use an assertion called assertEventually which samples
the
>> system for a success state until a certain timeout has elapsed. This
allows
>> you to synchronise the tests with asynchronous code.
>> Do we have an equivalent of that in the Ruby / RSpec world already? I
know
>> capybara has wait_until { } but that''s fairly rudimentary -
the failure
>> message isn''t very helpful. Is there anything else already out
there?
>> [1]?http://www.growing-object-oriented-software.com/
>> cheers,
>> Matt
>> --
>> Freelance programmer &?coach
>> Author, http://pragprog.com/book/hwcuc/the-cucumber-book (with Aslak
>> Helles?y)
>> Founder,?http://relishapp.com
>> +44(0)7974430184 | http://twitter.com/mattwynne
>>
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>
> the_object.should eventually_call(:foo).within(2).seconds
> Sounds like Matt is going to make us this matcher! :)
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>