title: Setting a session value through RSpec
body: <p>My current code looks like this:</p>
  
  <p><strong>/spec/support/spec_test_helper.rb</strong></p>
  
  <pre><code>module SpecTestHelper
    def login_admin
      user = FactoryGirl.create(:user, type: 0)
      session[:user_id] = user.id
    end
  end
  </code></pre>
  
  <p><strong>/app/controllers/application_controller.rb</strong></p>
  
  <pre><code>def current_user
    if session[:user_id].nil?
      render plain: 'Error', status: :unauthorized
    else
      @current_user ||= User.find(session[:user_id])
    end
  end
  </code></pre>
  
  <p>Unfortunately, session is always empty in the current_user method. Is there a way of controlling the session through RSpec?</p>