I’ve got a Capybara script with Rsped that includes :js => true, script that works fine when I execute the script in isolation. Yay! Here’s the script:
# spec/requests/capybara_and_js_spec.rb
require 'spec_helper'
describe "Associating Articles with Menus" do
it "should include javascript", js: true do
visit root_path
page.should have_selector('script')
end
end
When I execute the script I get:
.
Finished in 4.22 seconds
1 example, 0 failures
However, when I execute the same script with all of my specs via Guard Run all, I get this (I’ve omitted a couple thousand tests)
........................*...*..............Rack application timed out during boot
Rack application timed out during boot
F.....................................
I’ve spend quite a bit of time researching this issue, and found some interesting blog posts on the issue, but none of the solutions worked for me.
Here are the options I tried:
I switched from the default js driver for Capybara Selenium to Webkit and Poltergeist, like so:
and
but no luck with either.
Per this thread and this article I tried:
To no avail.
Then I found this article, so I attempted:
But no luck with that.
I also checked my database_cleaner settings to ensure DatabaseCleaner was playing nicely with my factories from FactoryGirl, per this issue on StackOverflow.
Still no luck.
Next I tried to parse out my capybara tests from my lower level rspec tests in my Guardfile, like so:
and SUCCESS! Finally!