4

when running RSpec, in the action of controller,(use byebug or pry) the specific value like (email or password) did not exist in the request parameters, and so the result of the test become failed for more details, see my below code

  path '/api/v1/admin/authentications/sign_in' do
    post('admin sign_in') do
      produces 'application/json'
      parameter name: :params, in: :body, schema: {
        type: :object,
        properties: {
          email: { type: :string },
          password: { type: :string }
        },
        required: %w[email password]
      }

      let(:admin) { create(:admin) }
      response('200', 'sign in successfully') do
        let(:params) { { email: admin.email, password: '***' } }
        run_test!
      end
    end
  end
ayza
  • 119
  • 10

2 Answers2

4

add consume type for your request:

consumes 'application/json'
Moeen
  • 414
  • 2
  • 8
0

I also had the same problem with the latest version of gem rswag. You can change the version of gem to "1.6" to fix it

thang tran
  • 23
  • 4