使用SimpleCov使Spring gem工作

kon*_*gun 4 ruby gem rspec cucumber

我使用spring的宝石,以加快我rspeccucumber测试.
spec/spec_helper.rb和我的features/support/env.rb文件中都有以下配置:

require 'simplecov'
SimpleCov.start 'rails'
Run Code Online (Sandbox Code Playgroud)

如果我用rspec spec/和开始我的测试,而rake cucumber:ok不是SimpleCov合并报告,我得到我想要的.
但是如果我使用spring rspec spec/spring cucumber features/,每个命令都会覆盖以前的报告而不会合并它们.
如何制作spring合并报告?

iai*_*ain 6

您需要为每个报告提供一个名称,以便Simplecov知道它们将被合并.Simplecov尝试发现命令,但spring命令使其无法实现,因此请手动执行.

所以在spec/spec_helper.rb:

SimpleCov.command_name "RSpec"
Run Code Online (Sandbox Code Playgroud)

并在features/support/env.rb:

SimpleCov.command_name "Cucumber"
Run Code Online (Sandbox Code Playgroud)

请记住停止弹簧服务器以使更改生效:

spring stop
Run Code Online (Sandbox Code Playgroud)

更多信息