dpassage
dpassage

Reputation: 5453

How do I get coverage for view specs with rspec, rails, and simplecov?

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?

Upvotes: 20

Views: 5644

Answers (1)

dpassage
dpassage

Reputation: 5453

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

Upvotes: 18

Related Questions