module Decidim::CapybaraTestHelpers

Helpers meant to be used only during capybara test runs.

Public Instance Methods

switch_to_default_host() click to toggle source
# File lib/decidim/dev/test/rspec_support/capybara.rb, line 16
def switch_to_default_host
  Capybara.app_host = nil
end
switch_to_host(host = "lvh.me") click to toggle source
# File lib/decidim/dev/test/rspec_support/capybara.rb, line 9
def switch_to_host(host = "lvh.me")
  raise "Can't switch to a custom host unless it really exists. Use `whatever.lvh.me` as a workaround." unless /lvh\.me$/.match?(host)

  app_host = (host ? "http://#{host}" : nil)
  Capybara.app_host = app_host
end
switch_to_secure_context_host() click to toggle source
# File lib/decidim/dev/test/rspec_support/capybara.rb, line 20
def switch_to_secure_context_host
  Capybara.app_host = "http://localhost"
end