I am using subdomains as account keys and some tests failed for controllers, they were looking for the account but didn’t find it.
The trick is to rewrite the host in the tests. Here’s the code for rspec.
before(:each) do @request.host = 'piku.mysite.net' end
Here, before each test the url is rewritten and the filter that finds the account happily does it job.