本文介绍了红宝石rspec将无法与simplecov一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了simplecov gem并添加了

I installed simplecov gem and added

require 'simplecov'  
SimpleCov.start

到spec_helper.rb文件,现在如果我在我的some_file_spec.rb文件中包含spec_helper.rb并尝试运行它,

to the spec_helper.rb file, now if i include spec_helper.rb in my some_file_spec.rb file and try to run it i get this

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下工作的。

Everything works fine without the simplecov, but i need the code coverage data for my ruby class.Thanks in advance for any tips you can give me on this. I work under win7 32

推荐答案

我似乎已经通过删除rspec并将rspec和simplecov捆绑安装在一起解决了这一问题。希望这对某人有帮助

I seem to have solved this by removing rspec and doing a bundle install of rspec and simplecov together. Hope this helps someone

这篇关于红宝石rspec将无法与simplecov一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 14:14