Last Updated: February 25, 2016
·
3.263K
· zkay

Fix Rspec+Capybara timeouts

Are you trying to run your tests only to see this staring back, laughing at you?

Rack application timed out during boot

Do you have a server/port definition in your rspec/capybara configs? Like so:

RSpec.configure do |config|
  config.include Capybara::DSL  
  Capybara.javascript_driver = :webkit
  Capybara.always_include_port = true
  Capybara.default_host = "http://#{DEFAULT_HOST}"
  Capybara.server_port = DEFAULT_PORT
  Capybara.app_host = "http://#{DEFAULT_HOST}:#{Capybara.server_port}"
  config.use_transactional_fixtures = false

Change it to this:

RSpec.configure do |config|
 config.include Capybara::DSL  
 Capybara.javascript_driver = :webkit_debug
 Capybara.always_include_port = true
 Capybara.default_host = "http://#{DEFAULT_HOST}"
#fixes issues with capybara not detecting db changes made during tests
config.use_transactional_fixtures = false

Capybara does not want you to specify what port it should run on. I was completely floundering on this until I ran across this buried in old docs for a testing site.

The more you know!