Subdomains, SubdomainFu, and Cucumber
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"
endand 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 = 1Now any path built after that Given will use the account’s subdomdain in the request.host.
<!-- Begin TwitThis script (http://twitthis.com/) -->
<!-- /End -->
- Add new comment
- 115 reads
- Feed: adsdevshop
- Original article


Recent comments
1 year 23 weeks ago
1 year 23 weeks ago
1 year 25 weeks ago
1 year 27 weeks ago
1 year 42 weeks ago
1 year 45 weeks ago
1 year 45 weeks ago
1 year 45 weeks ago
1 year 46 weeks ago
1 year 48 weeks ago