简体   繁体   English

一致的测试错误(Rspec核心2.14.5)

[英]Consistent Testing error (Rspec-core 2.14.5)

I'm going through Mhartl's tutorial and I'm sporadically getting this error when I run tests in the sublime text 2 console. 我正在阅读Mhartl的教程,当我在sublime text 2控制台中运行测试时,偶尔会收到此错误。 If I use bundle exec rspec/rspec in the the terminal it works fine, but it's not the case when call shortcut commands in sublime text to run tests. 如果我在终端中使用bundle exec rspec / rspec可以正常工作,但是在崇高的文本中调用快捷方式命令运行测试时,情况并非如此。 I don't know if it makes a difference but I'm also running guard 我不知道这是否有帮助,但我也要保持警惕

Users/User/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in `block in setup': You have already activated rspec-core 2.14.5, but your Gemfile requires rspec-core 2.13.1. Using bundle exec may solve this. (Gem::LoadError)

I tried searching stack overflow for solutions and tried bundle exec rake db:migrate(I normally don't specify bundle exec) as well as bundle exec rake test:prepare. 我尝试在堆栈溢出中搜索解决方案,并尝试了捆绑包执行佣金db:migrate(我通常不指定捆绑包执行)以及捆绑包执行佣金test:prepare。 Neither of which work. 两者都不起作用。

I'd appreciate not only an answer to the problem but perhaps a more in-depth answer of when to use rake db:migrate and rake test:prepare. 我不仅希望对问题有一个答案,而且对于何时使用rake db:migrate和rake test:prepare可能会得到更深入的回答,我将不胜感激。 I know their main uses, but there are perhaps some less obvious times where i would need to run it. 我知道它们的主要用途,但是也许有些不太明显的时候我需要运行它。 SPecifically, for this problem I would have thought rake test:prepare would be relevant and I'm still not sure what effect rake db:migrate has on the testing suite/rspec part of the application 具体来说,对于这个问题,我本以为rake test:prepare是相关的,但我仍然不确定rake db:migrate对应用程序的测试套件/ rspec部分有什么影响

为了回答您的部分问题,您可以通过bundle clean删除未使用的gem,尽管当我有多个版本的gem时,我发现我必须使用bundle clean --force ,这可能意味着我拥有了“系统gems”按照https://stackoverflow.com/a/10190608/1008891来使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM