title: Unit testing a controller method that is called via a custom route
body: <p>How do I unit test a controller method that is called via a custom route?</p>
  
  <p>The relevant route is:</p>
  
  <pre><code>/auth/:provider/callback(.:format) {:controller=&gt;"sessions", :action=&gt;"create"}
  </code></pre>
  
  <p>On the spec for the <code>SessionsController</code> I can't just use <code>get :create</code> since that route doesn't exist. If I also use <code>get /auth/facebook/callback/</code> it'll tell me that <code>No route matches {:controller=&gt;"sessions", :action=&gt;"/auth/facebook/callback"}</code>.</p>
  
  <p>It also seems like I can't just use <code>controller.create</code> since <code>#create</code> accesses some keys from the <code>request</code> hash and it also redirects to another path, even if I set request.env['something'] in the spec file.</p>