I'm attempting to write an integration test for my single page app written in Backbone and Rails 3.2 Things seem to be working on the client side when using an actual browser (Chrome) However, when testing using client-side code using Capybara (with Cucumber), the model's fetch() methods don't complete. I do: $.active jQuery call, and the number doesn't go to 0.. any ideas on what might be wrong?
page.execute_script("$.active") # -> 0
page.execute_script("App.backboneModel.fetch()")
page.execute_script("$.active") # -> 1
# ... long time later...
page.execute_script("$.active") # -> 1
I'm using capybara-webkit as the headless browser, and I also tried with Selenium/firefox. This above code works completely on an actual browser with a rails instance booted up, but it doesn't work during testing! The ajax calls don't complete for some reason... I am completely stumped.