When doing unit testing in Sinatra using Rack
and Test::Unit
, last_response.body.include?
gave me a false positive using a non-present test string.
Why does assert last_response.body.include?('string')
give a false positive when 'string'
isn't in the response body?
You need to check before if page was loaded correctly using:
assert last_response.ok?