title: Devise and OmniAuth twitter integration testing with rspec
body: <p>I am trying to write a integration test for signing in with twitter using OmniAuth and Devise. I am having trouble getting the request variable to be set. It works in the controller test but not the integration test which leads me to think that I am not configuring the spec helper properly. I have looked around, but I can't seem to find a working solution. Here is what I have so far:</p>
  
  <pre><code># spec/integrations/session_spec.rb
  require 'spec_helper'
  describe "signing in" do
    before do
      request.env["omniauth.auth"] = OmniAuth.config.mock_auth[:twitter]
      visit new_user_session_path
      click_link "Sign in with twitter"
    end
  
    it "should sign in the user with the authentication" do
      (1+1).should == 3
    end
  end
  </code></pre>
  
  <p>This  spec raies a error before it can get to the test and I am not quite sure where the <code>request</code> variable needs to be initialized. The error is:</p>
  
  <pre><code>Failure/Error: request.env["omniauth.auth"] = OmniAuth.config.mock_auth[:twitter]
    NoMethodError:
      undefined method `env' for nil:NilClass
  </code></pre>
  
  <p>Now I use the <code>request</code> variable in my controller spec and the test pass but it is not being initialized for the integration tests.</p>
  
  <pre><code> # spec/spec_helper.rb
   Dir[Rails.root.join("spec/support/*.rb")].each {|f| require f}
   ...
  
   # spec/support/devise.rb
   RSpec.configure do |config|
     config.include Devise::TestHelpers, :type =&gt; :controller
   end
  </code></pre>
  
  <p>Thanks for the help!</p>