Reputation: 1319
Getting the following error message.
Expected response to be a <success>, but was <422>
I've got a number of 422 responses each with error messages to help the consumer of my api know what is wrong.
But the 422 I'm getting in Minitest doesn't provide the error message as well.
How can that be included in the error message?
Upvotes: 2
Views: 609
Reputation: 1319
Adding the following code to the assert_response now produces the error message back.
assert_response :success, @response.body.to_s
Or if you need a specific error code.
assert_response 402, @response.body.to_s
Upvotes: 3