I’m still on Rails 2.3.x and using Rspec, Capybara and Steak to do some acceptance testing.
I want to be able to write 2 tests, one using the js driver and one using plain old rack-test.
Is it possible to write a test like this?
visit "/foo"
click_link "Load a new Foo via ajax!"
# assert foo loaded by ajax and not by browser natively following link
page.should have_content("New foo here")
Put another way, suppose a product requirement is “the page will not reload if the user has javascript enabled”. Is there a way to express that in a test (ie, that the page was not reloaded in its entirety)?
Yep this should work out of the box. Capybara has a default wait time. Just make sure that’s long enough to deal with the AJAX request. Here’s more info: http://codetunes.com/2011/08/20/testing-ajax-reloaded-elements-with-capybara
Also, any chance you looked at the EM video tag issue?