I am testing and coding a sinatra app using minitest. Currently, I use last_response.status to see what happened with the request by:
assert last_response.ok?, "Status 200 expected but was #{last_response.status}."
which displays errors like “Status 200 expected but was 500.” but I would like to display the sinatra.error in Rack ENV, like:
sinatra.error #<ArgumentError: wrong number of arguments (1 for 2)>
so that I don’t have to start the app and check it on the browser. I tried this code:
assert last_response.ok?, "#{last_response.error}."
but it threw a “private method `error’ called for #” error.
How can I display the values of the variables in sinatra error output?
You can use
puts last_response.errorsto show the Rack error messages for the last response.