0

I'm using Rails 4.2.0 and using minitest-rails-capybara gem.

I have set redirects in /etc/hosts like:

127.0.0.1 localhost
127.0.0.1 mydomain.ci
127.0.0.1 mydomain.com.gh
127.0.0.1 mydomain.com
127.0.0.1 mydomain.co.ao
127.0.0.1 mydomain.com.ng

I'm trying to set mydomain.com.ng in Capybara but I can't find the way.

This is how I'm trying to do it (test/test_helper.rb):

Capybara.app_host = "http://mydomain.com.ng:8000"
Capybara.server_host = "mydomain.com.ng"
Capybara.server_port = "8000"

I've tried this with but no success.

Any idea?

Community
  • 1
  • 1
borjagvo
  • 1,802
  • 2
  • 20
  • 35

1 Answers1

0

Since server_host defaults to 127.0.0.1 and you've set the domain you want to use to resolve to 127.0.0.1 there is no need to override server_host. Also do you actually have a need to run the Capybara server on a specific port? If you do then

Capybara.server_port = 8000
Capybara.app_host = "http://mydomain.com.ng:8000"

should work for you. If you don't actually need to fix the port (usual when working locally) then

Capybara.always_include_port = true
Capybara.app_host = "http://mydomain.com.ng

should be all you need. If you're still having problems with those settings then you need to provide info such as what driver you're using, what version of Capybara, what errors exactly you're getting, and an example of the test code that creates those errors.

Thomas Walpole
  • 48,548
  • 5
  • 64
  • 78