开发者

SimpleCov: Not run every time, just with rake task

Is there a possibility to run simplecov coverage-tool for rails just over a开发者_开发百科n rake task and not every time, when running the tests?


You can sort of work around this using an environment variable:

SimpleCov.start if ENV["COVERAGE"]

And then, running rake test / rspec / cucumber with

$ COVERAGE=true rake test


Another way to run SimpleCov with rake task only is to move the setup code out of the spec helper into Rakefile.

# Rakefile

... # normal Rakefile stuff


if defined? RSpec
  task(:spec).clear

  RSpec::Core::RakeTask.new(:spec) do |t|
    require 'simplecov'
    SimpleCov.start 'rails'
  end
end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜