我安装了simplecov gem并添加了
require 'simplecov'
SimpleCov.start
到spec_helper.rb文件,现在如果我在some_file_spec.rb文件中包含spec_helper.rb并尝试运行它我得到这个
c:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core/configuratio
n.rb:116:in `require': no such file to load -- rspec/core/mocking/with_rspec (Lo
adError)
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core
/configuration.rb:116:in `mock_framework'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core
/configuration.rb:376:in `configure_mock_framework'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core
/command_line.rb:19:in `run'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core
/runner.rb:55:in `run_in_process'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core
/runner.rb:46:in `run'
from c:/Ruby192/lib/ruby/gems/1.9.1/gems/rspec-core-2.5.1/lib/rspec/core
/runner.rb:10:in `block in autorun'
Coverage report generated for c:/Ruby192/bin/rspec player_spec.rb to c:/Users/Ko
Le/Documents/NetBeansProjects/CHCGame/spec/coverage. 0.0% covered.
没有simplecov,一切正常,但我需要我的ruby类的代码覆盖率数据。 在此先感谢您提供给我的任何提示。我在win7 32下工作
答案 0 :(得分:1)
我似乎通过删除rspec并一起进行rspec和simplecov的捆绑安装来解决这个问题。希望这有助于某人
答案 1 :(得分:1)
在gemfile中添加simplecov gem并进行bundle install。我认为这样可以解决问题
答案 2 :(得分:0)
确认您使用的是所需的宝石集