title: Rails token authentication and testing it
body: <p>I'm trying to pass a token into rails and validate it, but am getting a strange "render" error. Additionally, I'm not sure how to pass the "Authentication: Token token=" header through the RSPEC controller test.</p>
  
  <p>Here's the relevant code:</p>
  
  <p><strong>/app/controllers/api_base_controller.rb</strong></p>
  
  <pre><code># The authentication method in which I'm trying to set the @current_user
  class ApiBaseController &lt; RocketPants::Base
  
      private
  
          def authenticate_social  ## This is line 7 of the error below
              authenticate_or_request_with_http_token do |token, options|
                @current_customer = Customer.where(token: token).first
              end
          end
  end
  </code></pre>
  
  <p><strong>/app/controllers/api/v1/customers_controller.rb</strong></p>
  
  <pre><code># A simple method to "expose" (RocketPants' way of respond_with) the @current_customer from above
  class Api::V1::CustomersController &lt; ApiBaseController
      before_action :authenticate_social
  
    def fetch
          expose @current_customer
      end
  end
  </code></pre>
  
  <p><strong>/spec/controllers/api/v1/customers_controller_spec.rb</strong></p>
  
  <pre><code>RSpec.describe Api::V1::CustomersController, type: :controller do
    describe 'GET #fetch' do
      context '[Customer token exists]' do
        it 'returns the customer object' do
          @customer = FactoryGirl.create(:facebook_customer)
          get :fetch, version: 1  ## This is line 81 of the error below. Not sure how to pass token header
          expect(response).to be_singular_resource
        end
      end
    end
  end
  </code></pre>
  
  <p><strong>The rspec error</strong></p>
  
  <pre><code>3) Api::V1::CustomersController GET #fetch [Customer token exists] returns the customer object
       Failure/Error: get :fetch, version: 1
       NoMethodError:
         undefined method `render' for #&lt;Api::V1::CustomersController:0x007f9b20c39430&gt;
       # ./app/controllers/api_base_controller.rb:7:in `authenticate_social'
       # ./spec/controllers/api/v1/customers_controller_spec.rb:81:in `block (4 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p>I've searched high and low, but still, nothing. Thoughts?</p>