Is your Rails application cluttered up by extraneous templates that you aren’t using any more? Do you find it hard to work out which ones they are? Worry no more! Help is at hand.

I’ve made a simple plugin that tracks when a template is loaded, runs all your tests, and works out which ones were missed. Either you don’t need them, or you neglected to test them.

Install the plugin:

svn co http://paulbattley.googlecode.com/svn/template_coverage/trunk \
vendor/plugins/template_coverage

Type rake coverage:templates and load up doc/template_coverage.html.

Marvel at the pretty report.

template coverage report

Write some tests or delete the unused templates.