title: Problem with Rspec testing sign_in (Devise) with Request and rswag
body: <p>I was tempted to use rswag with rspec to document REST API and write test at the same time.
  I am trying to fallow tutorials and documentations but I cannot get sign_in endpoint working ( <a href="https://github.com/heartcombo/devise/blob/master/app/controllers/devise/sessions_controller.rb#L17" rel="nofollow noreferrer">devise - session</a> ).</p>
  <p>When I do run rspec than I receive status code error.</p>
  <pre><code>require 'swagger_helper'
  require 'rails_helper'
  require 'shared_context'
  
  describe 'Sonaaar REST API', type: :request do
  
  ...
  
    path '/users/sign_in' do
      post 'Sign In' do
        tags 'Session'
        consumes 'application/json'
        produces 'application/json'
        parameter name: :user, in: :body, schema: {
          type: :object,
          properties: {
            email: { type: :string },
            password: { type: :string },
          },
          required: ['email', 'password']
        }
  
       response '201', 'sign in', { 'HTTP_ACCEPT' =&gt; &quot;application/json&quot; } do
           response '201', 'sign in', { 'HTTP_ACCEPT' =&gt; &quot;application/json&quot; } do
          #
          # let(:user) do
          #   create(:user,  email: 'email@domain.com', password: 'Password1')
          # end
          #Error
          # Failure/Error:
          #        raise UnexpectedResponse,
          #          &quot;Expected response code '#{response.code}' to match '#{expected}'\n&quot; \
          #            &quot;Response body: #{response.body}&quot;
          #
          #      Rswag::Specs::UnexpectedResponse:
          #        Expected response code '401' to match '201'
          #        Response body: {&quot;error&quot;:&quot;You need to sign in or sign up before continuing.&quot;}
  
  
          let(:user) { { user: { login: 'email@domain.com', password: 'Password1' } } }
          # Rswag::Specs::UnexpectedResponse:
          #   Expected response code '401' to match '201'
          #   Response body: {&quot;error&quot;:&quot;You need to sign in or sign up before continuing.&quot;}
          #   /Users/filip/.rvm/gems/ruby-2.7.1/gems/rswag-specs-2.4.0/lib/rswag/specs/r
          run_test!
        end
  </code></pre>
  <p>Than i do have RSpec error:</p>
  <pre><code>1) Sonaaar REST API /users/sign_in post sign in returns a 201 response
       Failure/Error:
         raise UnexpectedResponse,
           &quot;Expected response code '#{response.code}' to match '#{expected}'\n&quot; \
             &quot;Response body: #{response.body}&quot;
  
       Rswag::Specs::UnexpectedResponse:
         Expected response code '401' to match '201'
         Response body: {&quot;error&quot;:&quot;You need to sign in or sign up before continuing.&quot;}
  </code></pre>
  <p>Authentication: JWT-token
  Content Type: application/json
  Stack/Gems:</p>
  <ul>
  <li>Ruby on Rails (Rails 6.1.2.1)</li>
  <li>devise (4.7.3)</li>
  <li>devise-jwt (0.7.0)</li>
  <li>rspec-rails (4.0.2)</li>
  <li>rswag (2.4.0) - <a href="https://github.com/rswag/rswag" rel="nofollow noreferrer">https://github.com/rswag/rswag</a></li>
  </ul>