I am trying to write some functional tests in my rails app, and in the application_controller.rb I have this:
before_filter :current_account
def current_account
@current_account ||= Account.find_by_subdomain!(request.subdomians.first)
end
When running tests, request.subdomains
doesn't contain the valid subdomains I'm looking for and makes it impossible to run any functional tests.
Is it possible to stub the current_account
method or mock the request.subdomains
object?