19
votes

I have a project in which I'm using rails 3.2.3, rspec 2.9.0, and simplecov 0.6.1, all seem to be the latest gems.

I'm getting code coverage results for my controllers and models, but not my views. I've tried adding the group in my simplecov setup:

SimpleCov.start 'rails' do
  add_group 'Views', 'app/views'
end

And even explicitly saying I want .erb files included:

SimpleCov.start 'rails' do
  add_group 'Views', 'app/views/*/*.erb'
end

...but no dice. The "Views" group is there in my coverage results, but no files are listed there.

Has anyone gotten this working?

1
Does this answer your question? How to test code coverage for Rails ERB templates?cdmo

1 Answers

18
votes

Apparently, the answer to this is "you can't", due to a limitation in the standard ruby coverage library:

https://github.com/colszowka/simplecov/issues/38