Under Asynchronous Javascript, the capybara README gives the following example of something that will wait for Ajax:
page.should have_text('baz')
That’s an RSpec construct, but I’m using Test::Unit + shoulda. What’s the equivalent in Test::Unit/shoulda? This is my code:
assert_equal 'foo', find('.bar').text
The line previous to that triggers an Ajax event. My assertion will succeed if executed after the ajax completes but fails if before. How do I tell it to keep retrying until it either succeeds or exceeds Capybara.default_wait_time ?
The capybara mailing list worked better than Stack Overflow even though it took the moderators over 24 hours to approve my post because of Turkey Day. Here is Jonas Nicklas’ response:
note that the negative form is:
and NOT:
this is WRONG, don’t do this. RSpec nowadays doesn’t have this problem
anymore, so its safe to do:
/Jonas