本文介绍了带有 RSpec-2 的 RCov的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一些前沿的 Rails 应用程序.Rails 3、RSpec 2、Rspec-Rails2.

I'm working with a bit of a bleeding edge rails app. Rails 3, RSpec 2, Rspec-Rails2.

似乎 RSpec2 不包含 RSpec 1 具有的 spec:rcov rake 任务.(至少现在还没有)

It seems as if RSpec2 doesn't include the spec:rcov rake task that RSpec 1 has. (at least it isn't there yet)

有没有人有幸使用 rspec 2 运行 rcov,或者编写自己的 rake 任务来完成这项工作?

Has anyone had any luck running rcov with rspec 2, or writing their own rake task to make this work?

推荐答案

尝试传入选项以排除 gem 目录.或者因为你的运行轨道使用了 rails 标志:

Try passing in options to exclude the gem directory. Or since your running rails use the rails flag:

desc  "Run all specs with rcov"
RSpec::Core::RakeTask.new(:rcov => spec_prereq) do |t|
  t.rcov = true
  t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/,features\/}
end

这篇关于带有 RSpec-2 的 RCov的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 17:22