Last Updated: July 14, 2018
·
3.516K
· tmartin314

Set user agent for rspec controller tests

In controller specs, you can just modify the Rack environment before making your request:

request.env['HTTP_USER_AGENT'] = 'Googlebot'
get :index