rails/rails — pull request #8658 by senny (2012-12-30 14:15:17+00:00)
Title: Unify routes output for console and web

We have a class called `RoutesInspector`. It's purpose is to aggregate the routes so that they can be displayed in the console (`rake routes`). Recently a routes listing was added to the exception page. This listing used parts of `RoutesInspector` but since the class was intermingled with formatting logic for the console, only parts could be reused. This led to #8649.

To solve this I did:

1. split the formatting logic and `RoutesInspector`.
1. when formatting a filter can be applied. We did not have test coverage for the filter argument, so I added a small test case.
1. The `RoutesInspector` now holds the routes it operates on as an instance variable. This allows to instantiate the inspector but apply the formatting later (when we don't have access to the routes anymore).
1. use the same code path to aggregate routes for the console and the web (only the formatter is different).
1. I noticed that there was no test, that rendered the routes table on the exception page. This could lead to embarrassing errors. I added such a test to make sure we don't have any obvious errors.

This fixes #8649