Skip to content

Instantly share code, notes, and snippets.

@dogweather

dogweather/visit_path.rb

Last active Jun 8, 2018
Embed
What would you like to do?
# 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
You can’t perform that action at this time.