ruby - How to test 404 Sinatra::NotFound errors with Rack::Test? -
i have application raises 404 sinatra::notfound errors on production when route missing.
however, following test passes:
it 'should not raise error' expect{ '/unknown_path' }.to_not raise_error end
why don't 404 sinatra::notfound errors raised in test?
the following raise error , cause test fail:
get '/unknown_path' raise 'error' end
how test 404 sinatra::notfound errors?
try this:
get '/unknown_path' assert_equal last_response.status, 404
Comments
Post a Comment