no referer defined in TestRequest

in my controller I do the following after login:

    redirect_to request.referer) || '/'

which works well until I test it, then the dwarfs complain that there is no referer defined. I did the following and it worked:

    redirect_to (defined?(request.referer) && request.referer) || '/'

It seems like there is no referer (nil or otherwise) defined for TestRequest. the curious thing though is that I'm the only who seems to have seem this problem. did everyone silently work around this...