In order to use Cucumber to test a site that uses subdomains to scope things like user accounts, add something like this to your relevant step:
Given /^An account$/ do
account = Factory(:account)
host! "#{account.subdomain}.example.com"
end
and if you’re using SubdomainFu, make sure the tld_size for your test environment is set to 1 (or whatever is appropriate). By default it is set to 0. You can do this in features/support/env.rb:
SubdomainFu.tld_size = 1
Now any path built after that Given will use the account’s subdomdain in the request.host.




