问题描述
我有一个项目,我在其中使用 rails 3.2.3、rspec 2.9.0 和 simplecov 0.6.1,所有这些似乎都是最新的 gems.
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.
我得到了控制器和模型的代码覆盖率结果,但不是我的视图.我试过在我的 simplecov 设置中添加组:
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
甚至明确说我想要包含 .erb 文件:
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.
有人用过吗?
推荐答案
显然,由于标准 ruby 覆盖库的限制,答案是你不能":
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
这篇关于如何使用 rspec、rails 和 simplecov 获取视图规范的覆盖范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!