Bring out your dead (Rails templates)
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.

Write some tests or delete the unused templates.
2008-01-15 13:18 UTC. Comments: 2.

Jason Roelofs
Wrote at 2008-01-17 18:57 UTC using Firefox 2.0.0.11 on Linux:
Hmm, doesn’t work. This dies quite spectacularly because it bypasses all of the things Rails does to setup tests, not the least of which is loading fixtures into databases.Love the idea, though.
Paul Battley
Wrote at 2008-01-17 19:46 UTC using Firefox 2.0.0.11 on Linux:
That’s interesting, but a little puzzling. We don’t have many fixtures, but the one test that does use them wasn’t affected.I don’t see how the normal Rails test loading is bypassed, though: it just loads the files and lets the normal END hook take care of running them. If the test files run on their own, it seems that they should work via this method.
I’d love a minimal test application that demonstrates the error.