Module: MultiClient::SpecHelpers::Feature

Defined in:
lib/multi_client/spec_helpers/feature.rb

Instance Method Summary collapse

Instance Method Details

#use_subdomain(subdomain) ⇒ Object



8
9
10
11
# File 'lib/multi_client/spec_helpers/feature.rb', line 8

def use_subdomain(subdomain)
  Capybara.current_session.driver.reset!
  Capybara.default_host = Capybara.default_host.sub(/(.*?\/\/)(.*?)(\..*)/, "\\1#{subdomain}\\3")      
end

#with_client(client, &block) ⇒ Object



4
5
6
# File 'lib/multi_client/spec_helpers/feature.rb', line 4

def with_client(client, &block)
  MultiClient::Client.with_client(client) { block.call }
end

#with_subdomain(subdomain, &block) ⇒ Object



13
14
15
16
17
18
# File 'lib/multi_client/spec_helpers/feature.rb', line 13

def with_subdomain(subdomain, &block)
  original_host = Capybara.default_host
  use_subdomain(subdomain)
  yield
  Capybara.default_host = original_host
end