Thanks for all the ideas. I just rolled my own which expects a block with an assertion in it:
https://gist.github.com/1228927 Could we put this into RSpec somewhere? I'd rather not dump the source into The Cucumber Book - it's too low level. I could put it into it's own little gem but that seems like creating clutter in the gemsphere. WDYT? On 13 Sep 2011, at 17:41, Alex Chaffee wrote: > Sure. "wait_for" is a method Brian Takita and I originally wrote for > use in Selenium tests, then IIRC it made it into the Selenium gem and > now lots of libraries use it (or their own version -- I make no patent > claim on polling :-)). The wait_for I remember allowed you to > customize the failure message. Let me go see if it's on GitHub or > anything... > > Ah, here's one: > https://github.com/pivotal/selenium/blob/master/lib/selenium/wait_for.rb > > (Maybe I should put it in Wrong.) > > - A > > On Tue, Sep 13, 2011 at 3:56 AM, Matt Wynne <m...@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@rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > > > > -- > Alex Chaffee - a...@stinky.com > http://alexch.github.com > http://twitter.com/alexch > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users 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@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users