In my helper module, I have:
def abc(url) ... if request.env[\'HTTP_USER_AGENT\'] do something end end
In my spec file, I have:
If you're using rspec-rails, you might be able to use controller.request in your helper tests.
controller.request