Set custom user agent on rails testing
<p>I am developing iOS app using <a href="https://github.com/turbolinks/turbolinks-ios" rel="nofollow noreferrer">turbolinks-ios</a> and Rails variant. </p>

<p>In my iOS app, I set custom user agent <code>iPadApp</code> and detect that on Rails <code>application controller</code> is using <code>request.user_agent.try(:index, 'iPadApp')</code> for setting <code>variant</code> to <code>tablet</code> (because by views are like <code>foo.html+tablet.haml</code>). </p>

<p>My app is working fine and now I am trying to write feature tests for my app but can't properly set user agent. I tried <a href="http://www.headshift.com/labs/2012/02/14/cucumber-to-test-mobile-in-a-rails-project/" rel="nofollow noreferrer">this</a> post that actually is <a href="https://stackoverflow.com/questions/3399156/using-cucumber-capybara-in-rails-3-how-do-i-set-a-custom-user-agent-string">stackoverflow</a> but I see that it does not set <code>request.user_agent</code> instead (<code>page.driver.browser.header(key, value)</code>) set query parameter with in <code>request.params</code>. </p>

<p>In my controller test I simply use <code>request.user_agent = 'iPadApp'</code> to set user agent which is working fine. </p>

<p>How can I configure testing request so that I can use <code>request.user_agent.try(:index, 'iPadApp')</code>?</p>

<p>Thank you for any kind of help. </p>