9
votes

Context

As asked before by others in 2012, see links below, I like to know if my Rails views are covered in my specs/cucs. I know that in 2012 the answer was that there was no solution. I was wondering if there is a solution now in 2014? I searched the web and did not find much, so I fear the answer is the same.

Motivation

I want to know if my cucumber features cover all parts of the API (in this case the GUI). When I add GUI functionality (new view, button, etc) but I somehow forget to add a cuccie for it, I want to get a notification. So it's not so much that I want to cover everything in my views, but I want to prevent that I unintentionally forget to add a cuccie for new user features. Hence reducing the chances of code not working in production.

Research

I found the following links, mentioned above:

A potentially interesting approach that I want to look into is:

1

1 Answers

2
votes

I want to prevent that I unintentionally forget to add a cuccie for new user features.

The pedantic answer is that you could make sure to write those tests before adding the features (or at least commit them at the same time.) But, that's overly dogmatic and not always realistic.

SimpleCov or another test coverage tool can help you monitor this indirectly, even though it can't measure coverage in views directly (because they're not written in Ruby.)

If you're covering every controller action, model and view helper method, then you're probably in good shape. (This works best if you avoid putting logic in the views wherever possible.)