Currently, I am almost completing a long way in testing rails, but I hit my head on how to get query specifications that work with subdomains.
In development, I use pow with URLs such as:, http://teddanson.myapp.dev/accountwhich is all fine and dandy.
In testing, I let capybara do this, which returns localhost http://127.0.0.1:50568/account, which obviously does not play well with the entire subdomains. It works great for the public part of the application, which does not require subdomains, but how to access the user’s subdomain account outside of me.
Access to the appropriate routes is carried out using the following methods:
class Public
def self.matches?(request)
request.subdomain.blank? || request.subdomain == 'www'
end
end
class Accounts
def self.matches?(request)
request.subdomain.present? && request.subdomain != 'www'
end
end
, , , - - , , , . !