you can check active ajax calls with jquery
$.active
If you use capybara for integration tests
page.evaluate_script('$.active').should be <= 1
may be a solution.
As you probably donβt know when calls arise, a helper function can do the trick
def test_until(seconds=5) start_time = Time.now while (Time.now - start_time) <= seconds do yield sleep 0.05 end end
which can be called so
test_until do page.evaluate_script('$.active').should be <= 1 end
So you test 5 seconds if there is another ajax call active
rapimo
source share