title: How to access session from Rails Integration Test?
body: <p>Consider the following integration test:</p>
  
  <pre><code>test "if there is no user in session, redirect to index and flash message" do
    open_session do |sess|
      post '/login', :email =&gt; users(:client).email, :password =&gt; 'rumpelstiltskin'
      sess[:user] = nil
      get '/user_page'
      assert_redirected_to index_path
      assert_equal "Your session has expired. Please log in again", flash[:notice]
    end    
  end
  </code></pre>
  
  <p>This generates error: <code>undefined method '[]='</code></p>
  
  <p>And, changing to <code>sess.session[:user] = nil</code> generates an error as well: <code>NoMethodError: undefined method 'session' for nil:NilClass</code></p>
  
  <p>How do you modify the session params from an integration test in Rails?</p>
  
  <p>Working in Rails 3.0.7, Ruby 1.9.2p180, Unit test framework.</p>
  
  <p>EDIT:<br>
  <code>get '/user_page', nil, {:user =&gt; nil}</code> and <code>get ('/user_page', nil, {:user =&gt; nil} )</code> generate errors.</p>