Code coverage tools for haml?

655 views Asked by At

It looks like it's quite possible to get a useful coverage report for Haml code, due to its one one-statement-per-line structure.

Do you know of any code coverage tools for Haml? Maybe something is in the works?

2

There are 2 answers

2
nathanvda On BEST ANSWER

Code coverage generally makes sure you cover all your code-paths. If you have a lot of logic in your view, that is a smell. I think logic should be moved to your helpers, controllers (render a different view) or presenters, and those you can test with perfect coverage.

Aside of that: theoretically it should be possible, but i would not want to encourage placing too much "intelligence" in views.

0
Ira Baxter On

One problem with non-mainstream languages (such as HAML) is that tools are hard to find, because they are hard to build.

This technical paper Branch Coverage for Arbitrary Languages Made Easy (I'm the author) describes how to build test coverage tools for langauges in systematic way to help get around this problem, using a generic tool-building infrastructure.