title: undefined method `response' for nil:NilClass rspec test
body: <p>I created a test, and for some reason the should is run on a nil type.
  I am using rails 4.2 and rspec-rails 3.1.0. I am not sure what I am doing wrong - this is the test, and the error is on the last <code>it { should respond_with 401 }</code> test</p>
  
  <pre><code>require 'rails_helper'
  
  class Authentication
    include Authenticable
    def request
    end
  
    def response
    end
  end
  
  describe Authenticable do
    let(:authentication) { Authentication.new }
  
    describe "#current_user" do
      before do
        @user = FactoryGirl.create :user
        request.headers["Authorization"] = @user.auth_token
        allow(authentication).to receive(:request).and_return(request)
      end
      it "returns the user from the authorization header" do
        expect(authentication.current_user.auth_token).to eql @user.auth_token
      end
    end
  
    describe "#authenticate_with_token" do
      before do
        @user = FactoryGirl.create :user
        allow(authentication).to receive(:current_user).and_return(nil)
        allow(response).to receive(:response_code).and_return(401)
        allow(response).to receive(:body).and_return({"errors" =&gt; "Not authenticated"}.to_json)
        allow(authentication).to receive(:response).and_return(response)
      end
  
      it "render a json error message" do
        expect(json_response[:errors]).to eql "Not authenticated"
      end
  
      it {  should respond_with 401 }
    end
  end
  </code></pre>