Tag your scenarios in spec/acceptance/*_spec.rb to use Javascript driver if necessary.
some_spec.rb
12
scenario'Create a lolita via AJAX',:js=>truedoend
Wait for any AJAX call to be completed in your specs. This is very important, or you will get many strange issues like no database record found, AJAX call get empty response with 0 status code, etc.
For example if you have a simple AJAX form, the success callback will simply redirect browser to another page via location.href = '/yet_another_page';. You can use the following code to wait for it done.
another_spec.rb
123456789
scenario'Create a lolita via AJAX',:js=>truedovisitnew_lolita_pathclick_on'Submit'wait_until{page.current_path==lolita_path(Lolita.last)}# Your expections for the new pageend