Topic: Adding views to rake stats or rcov test coverage...

Has anyone tried adding the code in app/views/ to the files that get included in rake stats or in rake test:rcov?

I tried digging into the rake stats task to figure out how to add files and the *.rb regexp is buried rather deeply in the code without a good way to provide an alternate regexp for a directory without just hard-coding it in the code.  I haven't dug too deep into rcov yet to see how it handles it.

Its not a big deal for stats, so if I can't get it, its no big deal.  It would be nice to have an easy way to audit which templates don't have view test cases though, and I was hoping to piggyback on rcov for that.  (Given that most views are relatively conditional free they will probably end up being either 0% or 100% covered)

For stats, its slightly annoying that view tests artificially inflate the Test:Code ratio (as the tested "code" isn't included in to LOC count.  I expect code:test to stabilize close to 1:1.  I know many people report values closer to 1:4 with Rails, but I think that's primarily due to the fact that the stock assertions are slightly "underpowered" and that some of the rails conventions tutorials don't demonstrate refactoring test code very effectively.

In my two (still small projects), i've been tracking about 1:1.4 for model code and 1:2 for controller code (1:3 if view tests are included in test code for controller).  If I break out view LOC (for now counting both constant html and eRb), the ratio is about 1:0.3 for view code.  (Which actually seems about right -- I want to have tests that assert the "functional interface" while leaving some of the design related page structure flexible.

Now of course code:test ratios don't really mean anything.  However I do think its worth looking at places where, repeatedly the amount of test code dwarfs the application code -- this is a sign that the testing language isn't as high level as the application language and thus ripe for custom assertions, etc

And f course I'm very torn as to what a LOC is in a template file....  any line with embedded Ruby?  any non whitespace?, etc

My RoR journey  -- thoughts on learning RoR and lessons learned in applying TDD and agile practices.