Skip to content

Instantly share code, notes, and snippets.

@dogweather
Last active June 8, 2018 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dogweather/3ed46e9211fd327ad2b5ace2e50c0842 to your computer and use it in GitHub Desktop.
Save dogweather/3ed46e9211fd327ad2b5ace2e50c0842 to your computer and use it in GitHub Desktop.
# Perform a Capybara.visit to the given hostname.
def visit_path(path, at_host:)
MyRailsHelper.set_capybara_host(to_domain: at_host)
Capybara.visit path
end
module MyRailsHelper
def self.set_capybara_host(to_domain:)
Capybara.current_session.driver.reset!
Capybara.app_host = "http://#{to_domain}"
Capybara.always_include_port = true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment