title: how to set user agent in rspec route assertions
body: <p>I am trying to use rails-rpec route specs to test different routing based on different user agents, and I cannot find the correct method or object to stub. </p>
  
  <p>My method looks like this: </p>
  
  <pre><code>require "spec_helper"
  
  describe "articles routing" do
    describe "/articles/#slug" do
  
      it "routes to Articles#show" do
        get("/articles/fancy-slug").should route_to(controller: "articles",
                                                      action:     "show",
                                                      id:         "fancy-slug")
      end
  
      describe "when you have an iphone user agent" do
        before(:each) do
          # SOMETHING MAGICAL HAPPENS ALONG THE LINES OF THE LINE BELOW
          # request.user_agent = "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B329 Safari/8536.25"
        end
  
        it "routes to Mobile::Articles#show" do
          expect(get: "/articles/fancy-slug").to route_to(controller: "mobile_articles",
                                                        action:     "show",
                                                        id:         "fancy-slug")
        end
      end
  
    end
  end
  </code></pre>
  
  <p>But for the life of me, I cannot figure out how to stub the request, or the controller, or the whatever. Most of the available documentation seems to refer to an old/outdated version of the <code>get</code> syntax. </p>