title: How to use HTTP status code symbols in RSpec?
body: <p>I use <a href="https://github.com/rails/rails/blob/v4.0.0/guides/source/layouts_and_rendering.md#the-status-option" rel="noreferrer">HTTP status code symbols</a> in code in a controller such as:</p>
  
  <pre class="lang-ruby prettyprint-override"><code>render json: {
      auth_token: user.authentication_token, 
      user: user
    }, 
    status: :created
  </code></pre>
  
  <p>or</p>
  
  <pre class="lang-ruby prettyprint-override"><code>render json: {
      errors: ["Missing parameter."]
    }, 
    success: false, 
    status: :unprocessable_entity
  </code></pre>
  
  <p>In the code of  my request spec I also would like to use the symbols:</p>
  
  <pre class="lang-ruby prettyprint-override"><code>post user_session_path, email: @user.email, password: @user.password
  expect(last_response.status).to eq(201)
  </code></pre>
  
  <p>...</p>
  
  <pre class="lang-ruby prettyprint-override"><code>expect(last_response.status).to eq(422)
  </code></pre>
  
  <p>However each test where I use the symbols instead of integers fails:</p>
  
  <pre class="lang-shell prettyprint-override"><code>Failure/Error: expect(last_response.status).to eq(:created)
  
    expected: :created
         got: 201
  
    (compared using ==)
  </code></pre>
  
  <hr>
  
  <p>Here is the latest list of <a href="https://github.com/rack/rack/blob/master/lib/rack/utils.rb#L581" rel="noreferrer">HTTP status code symbols in Rack</a>.</p>