title: omniauth mock facebook response
body: <p>I'm want to test my login through facebook. Im using pure omniauth, w/o Devise. I check the wiki page and do following:</p>
  
  <p>helper for request specs</p>
  
  <pre><code>module IntegrationSpecHelper
    def login_with_oauth(service = :facebook)
      visit "/auth/#{service}"
    end
  end
  </code></pre>
  
  <p>spec_helper.rb</p>
  
  <pre><code>    RSpec.configure do |config|
        config.include IntegrationSpecHelper, :type =&gt; :request
      end
  
      Capybara.default_host = 'http://example.org'
      OmniAuth.config.test_mode = true
      OmniAuth.config.add_mock(:facebook, {
      :provider =&gt; 'facebook',
      :uid =&gt; '12345',
      :user_info =&gt; {
          :name =&gt; 'dpsk'
        }
  })
  </code></pre>
  
  <p>my spec</p>
  
  <pre><code>require 'spec_helper'
  
  describe 'facebook' do
    it "should login with facebook", :js =&gt; true do
      login_with_oauth
  
      visit '/'
      page.should have_content("dpsk")
    end
  end
  
  
  #OmniAuth routes
    match "/auth/:provider/callback" =&gt; "sessions#create"
    match "/signout" =&gt; "sessions#destroy", :as =&gt; :signout
    match "/signin" =&gt; "sessions#signin", :as =&gt; :signin
    match "/auth/failure" =&gt; "sessions#failure", :as =&gt; :auth_failure
  </code></pre>
  
  <p>But in spec nothing returns instead of my mock i got an error:</p>
  
  <pre><code>Failure/Error: visit "/auth/facebook"
       You have a nil object when you didn't expect it!
  You might have expected an instance of Array.
  The error occurred while evaluating nil.[]
  </code></pre>
  
  <p>Where is my error?</p>