I am using rSpec for testing my application. In my application controller I have a method like so:
def set_current_account
@current_account ||= Account.fi
Chris Peters' answer worked for me for Request specs, but for Feature specs, I had to make the following changes:
rails_helper:
Capybara.app_host = 'http://lvh.me'
Capybara.always_include_port = true
feature_subdomain_helpers:
module FeatureSubdomainHelpers
def within_subdomain(subdomain)
before { Capybara.app_host = "http://#{subdomain}.lvh.me" }
after { Capybara.app_host = "http://lvh.me" }
yield
end
end