为什么 RCov 排除视图并包含评论?
我正在使用 Rails 3、RSpec 2 和 rcov gem。 我正在使用以下 rake 任务在我的规格上运行 rcov:
desc "Run all specs with rcov"
RSpec::Core::RakeTask.new(:rcov => spec_prereq) do |t|
t.rcov = true
t.pattern = "./spec/**/*_spec.rb"
t.rcov_opts = %w{--rails --include views -Ispec --exclude gems\/,spec\/,features\/,seeds\/}
end
首先,视图规格不包含在结果中。怎么才能看到代码 rcov 结果中视图的覆盖范围? 其次,模型的代码覆盖率相当低。 当我查看详细信息时,这是因为注释行突出显示 如未执行。 我该如何解决这个问题? 最后,似乎大多数(如果不是全部)方法定义都被标记了 如未执行。 有办法纠正这个问题吗? 谢谢,达林
I am using Rails 3, RSpec 2 and the rcov gem.
I am running rcov on my specs with the following rake task:
desc "Run all specs with rcov"
RSpec::Core::RakeTask.new(:rcov => spec_prereq) do |t|
t.rcov = true
t.pattern = "./spec/**/*_spec.rb"
t.rcov_opts = %w{--rails --include views -Ispec --exclude gems\/,spec\/,features\/,seeds\/}
end
Firstly the view specs are not included in the results. How can I see code
coverage for the views in the rcov results?
Secondly, the code coverage for the models are quite low.
When I look at the details it is because the comment lines are highlighted
as not executed.
How can I fix this?
Lastly, it seems that most (if not all) of the method definitions are marked
as not executed.
Is there a way to correct this?
Thanks, Daryn
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您确定 rcov 应该“按原样”与 Rails3 一起工作吗?
您是否正在采取任何措施使其正常工作 - 我在网上看到了一些解决方法:
http:// /www.betaful.com/?p=498
https://github.com/nathanhumbert/rails_code_qa< /a>
诚然,我不知道 RSpec,也许它包装 rcov 的方式已经涵盖了这一点......
Are you sure rcov should work "as-is" with Rails3?
Are you doing anything to make it work - I see a couple of work-arounds on the web:
http://www.betaful.com/?p=498
https://github.com/nathanhumbert/rails_code_qa
Admittedly, I dont know RSpec and that perhaps has this covered in the way it wraps rcov...