I’m using Capybara and Selenium together with RSpec to test the Web Interface for VersionEye. That works very well. For an integration test I needed a callback on localhost:3000/auth/*. By Default Capybara is starting the tests on an odd host and port name to avoid conflicts with locahost:3000, which is the default host and port for Rails Apps in development. It took me something like 30 min. to find out how to force capybara to run all Tests on localhost:3000. That’s why I think it’s worth blogging 🙂
Either in your `spec_helper.rb` or in `spec/support/capybara.rb` you will have this imports:
require 'capybara/rails' require 'capybara/rspec' require 'capybara/firebug'
Below that you can configure Capybara like this.
Capybara.app_host = "http://localhost:3000" Capybara.server_host = "localhost" Capybara.server_port = "3000"
That worked for me.
Thank you!
Much appreciated! It took me too long to figure out why, in integration tests only, my frontend was getting CORS errors when calling my backend API. Setting the Capybara host fixed it.