Rcov 显示未涵盖的指定方法
我现在有点混乱,但要点是我可以成功运行 rake spec:rcov 并获得报告,但它显示的所有内容都被覆盖了我的代码的“def”行。方法内的任何代码都没有根据 rcov 运行。
具体来说,我的应用程序助手中有一个 disp_price_txt 方法。我已经在spec/helpers/application_helper_spec.rb 中编写了传入rspec 的规范。但是 rcov 并未显示正在运行的代码。
我的宝石在下面。我正在使用 ree 1.8.7-head。我从安装 Metrical 开始,打算使用 simplecov,直到我意识到它仅适用于 1.9。然后我又回到了rcov。
导轨 (3.1.1) rspec(2.8.0、2.7.0) rspec-核心(2.8.0、2.7.1) rspec 期望(2.8.0、2.7.0) rspec-模拟(2.8.0、2.7.0) rspec-rails(2.8.1、2.7.0) rcov (0.9.11)
希望这足以获得一些输入。如果需要任何其他信息,请告诉我。 谢谢。
I kind of have a mess going right now, but the gist is I can run rake spec:rcov successfully and get a report but all it shows as being covered is the "def" lines of my code. None of the code inside the methods is being run according to rcov.
Specifically I have a disp_price_txt method in my application helper. I have written specs, that pass in rspec, in spec/helpers/application_helper_spec.rb. However rcov is not showing the code as being run.
My gems are below. I'm using ree 1.8.7-head. I started out by installing Metrical and was going to uses simplecov until I realized it was for 1.9 only. Then I went back to rcov.
rails (3.1.1)
rspec (2.8.0, 2.7.0)
rspec-core (2.8.0, 2.7.1)
rspec-expectations (2.8.0, 2.7.0)
rspec-mocks (2.8.0, 2.7.0)
rspec-rails (2.8.1, 2.7.0)
rcov (0.9.11)
Hopefully this is enough to get some input. If any other info is needed let me know.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来我在我的spec_helper.rb 中缺少“require 'rspec/autorun'”。我继承了这个项目,所以我不确定它是否被删除了。我的猜测是 rspec gem 已更新,但 spec_helper.rb 来自较旧的 gem。不管怎样,问题已经解决了,一切正常!!!
Looks like I was missing "require 'rspec/autorun'" in my spec_helper.rb. I inherited this project so I'm not sure if it was removed. My guess is the rspec gem was updated but the spec_helper.rb was from an older gem. Anyway it's solved and everything is working!!!