westfieldlabs / apivore

Tests your rails API against its Swagger description of end-points, models, and query parameters.
Apache License 2.0
213 stars 66 forks source link

How to handle response? #125

Closed kopylovvlad closed 5 years ago

kopylovvlad commented 5 years ago

Hello. Sometimes I need to check the response manually. For example, I have an endpoint, it should return an array of objects. I want to check response size (is it more than 0?). How could I do it?

kopylovvlad commented 5 years ago

I have found the way how to do it.

validator = validate(:get, '/deals/{id}.json', 200, params)
expect(subject).to validator
expect(validator.response_body.size).to be > 0