I have a Rails 3 integration test which tests my routes. It contains tests such as:
assert_routing(
\"/#{@category.url.path}/#{@foo.url.path}\",
{ :c
I ended up doing this:
def test_no_routes_match_when_neither_foo_nor_bar_exist
assert_raises(ActionController::RoutingError) do
assert_recognizes({}, '/category/this-is-neither-a-foo-nor-a-bar')
end
end
Slightly silly, but it gets the job done.
Note that this does not work with Rails 4. See the answer below for a Rails 4 solution.