title: Stubbing a 500 error
body: <p>I am having an issue with webmocks stubbing.</p>
  
  <p>This is a Rails 4 application using devise/cancan for Authentication and Authorisation.  I am using RSpec to write my tests. </p>
  
  <p>I have a (simplified for the cause of this post!) test that I'd like to run.</p>
  
  <pre><code>require 'rails_helper'
  
  RSpec.describe ApiChecksController, type: :controller do
  
    include Devise::TestHelpers
  
    let(:user)          { FactoryGirl.create :user }
    let(:api_params) do
      {
        param_1: 'VALUE',
        param_2: '1980-01-01',
        param_3: 'AA123',
        param_4: "#{Date.today}"
      }
    end
  
    context 'logged in as standard user' do
    describe 'POST #lookup' do
        context 'displays error' do
          it 'when 500 returned' do
            WebMock.disable_net_connect!(allow: 'codeclimate.com')
            sign_in user
            stub_request(:post, "#{ENV['API_PROXY']}/api/checks").
              to_return(status: [500, "Internal Server Error"])
            post(:lookup, api_check: api_params)
            expect(response.status).to eq(500)
          end
        end
      end
    end
  end
  </code></pre>
  
  <p>In the full test suite everything above the expect statement is set using lets or set in before blocks.  I tried to distil it down to the smallest options and the test is still failing.</p>
  
  <p><strong>Question</strong></p>
  
  <p>I was expecting </p>
  
  <pre><code>stub_request(:post, "#{ENV['API_PROXY']}/api/checks").
    to_return(status: [500, "Internal Server Error"])
  </code></pre>
  
  <p>to always return a 500 status response, but it is returning 200.</p>
  
  <p>Were my expectations correct? Is this how webmocks should be called?</p>