title: How to use RSpecs valid_session?
body: <p>I'm having trouble finding examples of valid_session in RSpec, and now all my scaffolded tests are broken after having added authorization.</p>
  
  <p>Going through Michael Hartl's Rails Tutorial, I'm using the authentication which is described <a href="http://ruby.railstutorial.org/chapters/sign-in-sign-out" rel="noreferrer">here</a>, except I'm requiring login for all pages and use 'skip_before_filter' for signin etc.</p>
  
  <p>I've added a user fixture, which I've verified gets loaded:</p>
  
  <pre><code>userexample:
    id: 1
    name: Example Name
    email: examplename@example.com
    password_digest: $2a$10$NuWL8f2X0bXaCof3/caiiOwlF2rago7hH10JECmw1p75kEpf0mkie
    remember_token: YXjPrFfsK8SFQOQDEa90ow
  </code></pre>
  
  <p>Then in the controller spec</p>
  
  <pre><code>def valid_session
      { remember_token: "YXjPrFfsK8SFQOQDEa90ow" }
  end
  </code></pre>
  
  <p>The code of the Session Helper </p>
  
  <pre><code>module SessionsHelper
  def sign_in(user)
      cookies.permanent[:remember_token] = user.remember_token
      self.current_user = user
  end
  
  def signed_in?
      return !current_user.nil?
  end
  
  def sign_out
      self.current_user = nil
      cookies.delete(:remember_token)
  end
  
  def current_user=(user)
      @current_user = user
  end
  
  def current_user
      @current_user ||= User.find_by_remember_token(cookies[:remember_token])
  end
  end
  </code></pre>
  
  <p>Am I using valid_session as intended? Will supplying a remember_token with the session even work without explicitly signing in the user with sign_in? Could this be solved in some other way?</p>