title: testing a current_user in application_controller with Rspec
body: <p>I have a standard current_user in application_controller like this:</p>
  
  <pre><code>describe ApplicationController &lt; ActionController::Base
  
    helper_method :current_user
  
    def current_user
      @current_user ||= User.find_by_auth_token(session[:auth_token]) if session[:auth_token]
    end
  </code></pre>
  
  <p>I'm curious as to how or whether if this should be tested. I was thinking like (this works but I'm not sure if there is a better way or whether even necessary):</p>
  
  <pre><code>describe 'current_user' do
    it 'should return a valid_current' do
      user=FactoryGirl.create(:user)
      user.auth_token='abc123'
      user.save
      request.session['auth_token']='abc123'
      returned_user=controller.send(:current_user) # not sure about this
      returned_user.id.should eq(user.id)
    end
  end
  </code></pre>
  
  <p>but not really sure? I'm testing our auth in other places for our api but curious (1) how or (2) whether this should be tested (even for completeness)?</p>
  
  <p>thx</p>