Question

I'm using Pow to serve up my development environment. In my config/environments/development.rb and test.rb files, I had this line:

Rails.application.routes.default_url_options[:host] = "myapp.dev"

But of course that doesn't work, because then my RSpec/Capy integration test run against the development database and don't match the factory data.

Why does this even matter? I thought the testing suite spun up its own Rack server. Since it does appear to matter, to what do I set it?

Was it helpful?

Solution

Change the port in your spec_helper.rb for starters, as you're apparently running tests in your development environment.

Capybara.run_server = true 
Capybara.server_port = 7000
Capybara.app_host = "http://localhost:#{Capybara.server_port}" 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top