Module: Decidim::CapybaraTestHelpers
- Defined in:
- lib/decidim/dev/test/rspec_support/capybara.rb
Overview
Helpers meant to be used only during capybara test runs.
Instance Method Summary collapse
Instance Method Details
#switch_to_default_host ⇒ Object
18 19 20 |
# File 'lib/decidim/dev/test/rspec_support/capybara.rb', line 18 def switch_to_default_host Capybara.app_host = nil end |
#switch_to_host(host = "lvh.me") ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/decidim/dev/test/rspec_support/capybara.rb', line 9 def switch_to_host(host = "lvh.me") unless /lvh\.me$/.match?(host) raise "Can't switch to a custom host unless it really exists. Use `whatever.lvh.me` as a workaround." end app_host = (host ? "http://#{host}" : nil) Capybara.app_host = app_host end |