title: Devise + Omniauth - testing - getting no route matches "/oauth/authorize"
body: <p>I'm trying to write tests for authentication with Twitter and Facebook. I am using Devise and Omniauth. When I try it out it works correctly, but I can't get the tests to pass for it.</p>
  
  <p>I'm following <a href="http://blog.codegram.com/2011/2/acceptance-tests-with-cucumber-devise-omniauth-and-twitter" rel="nofollow">instructions</a>, but it isn't in depth enough for me, plus I'm doing things a little differently (already have some code base). I have a custom controllers for omniauth_callbacks and registrations.</p>
  
  <p>My problem is that when I run the tests it says:</p>
  
  <pre><code>(::) failed steps (::)
  
  No route matches "/oauth/authorize" (ActionController::RoutingError)
  &lt;internal:prelude&gt;:10:in `synchronize'
  (eval):2:in `click_link'
  ./features/step_definitions/web_steps.rb:57:in `/^(?:|I )follow "([^"]*)"$/'
  features/link_twitter.feature:19:in `And I link twitter'
  
  Failing Scenarios:
  cucumber features/link_twitter.feature:16 # Scenario: User links twitter
  </code></pre>
  
  <p>Where is this <code>/oauth/authorize</code> route coming from and how do I handle that?</p>
  
  <p>It does not look like it is getting to my <code>OmniauthCallbacksController</code>. It follows the link and then dies. I think it has to do with Omniauth's call back method during test mode, but I'm not sure how to change / manage that.</p>
  
  <p><strong>Update</strong>: Here are my routes for Devise.</p>
  
  <pre><code>devise_for :users, :controllers =&gt; { 
      :omniauth_callbacks =&gt; "users/omniauth_callbacks", 
      :registrations =&gt; 'registrations', 
      :passwords =&gt; 'passwords', 
      :sessions =&gt; 'sessions', 
      :confirmations =&gt; 'confirmations' 
  } do
    match 'confirmations/unconfirmed' =&gt; 'confirmations#unconfirmed', :as =&gt; :unconfirmed
    match 'confirmations/send_advisor_confirmation/:id' =&gt; 'confirmations#unregistered_advisor_confirmation', :as =&gt; :send_advisor_confirmation
    get '/users/auth/:provider' =&gt; 'users/omniauth_callbacks#passthru'
  end
  </code></pre>