There is a similar way for checking this in Rails 4 by asserting on the UrlGenerationError exception:
def test_no_routes_match_when_neither_foo_nor_bar_exist
assert_raises(ActionController::UrlGenerationError) do
get '/category/this-is-neither-a-foo-nor-a-bar'
end
end