[英]Running a spec in RubyMine results in “cannot load such file — teamcity/spec/runner/formatter/teamcity/formatter (LoadError)”
OS: Arch Linux, Rails version: 4, RubyMine: 6.3 操作系统:Arch Linux,Rails版本:4,RubyMine:6.3
When I run a spec from Tools - Run Rake Task - spec I always get this error: 当我从工具运行规范 - 运行Rake任务 - 规范我总是得到这个错误:
/home/chylli/.rvm/gems/ruby-2.1.2@rails4/gems/rspec-core-3.0.2/lib/rspec/core/configuration.rb:1024:in `require': cannot load such file -- teamcity/spec/runner/formatter/teamcity/formatter (LoadError)
/home/chylli/.rvm/gems/ruby-2.1.2@rails4/gems/rspec-core-3.0.2/lib/rspec/core/configuration.rb:1024:in`requirement':无法加载此类文件 - - teamcity / spec / runner / formatter / teamcity / formatter(LoadError)
but it is OK to run 'debug spec:models'. 但运行'debug spec:models'是可以的。
What I tried: I added 'ruby arguments' under Run - edit configurations: 我尝试了什么:我在Run - edit配置下添加了'ruby arguments':
-I$RUBYMINE_HOME/rb/testing/patch/bdd -I$RUBYMINE_HOME/rb/testing/patch/common
-I $ RUBYMINE_HOME / rb / testing / patch / bdd -I $ RUBYMINE_HOME / rb / testing / patch / common
but it doesn't work. 但它不起作用。
Run 跑
spring stop
on the command line before running rake from RubyMine, or running specs directly, or doing anything else that uses spring. 在从RubyMine运行rake,或直接运行specs,或使用spring执行任何其他操作之前,在命令行上。
You don't need to do this every time you run rake or specs or whatever in RubyMine, only if you previously started spring by running rake or doing something else that starts spring outside of RubyMine. 每次在RubyMine中运行rake或specs或者其他任何东西时都不需要这样做,只有当你以前通过运行rake或者在RubyMine之外开始运行的其他东西开始运行时才会这样做。 You also don't need to
spring stop
when you switch from RubyMine back to the command line. 当您从RubyMine切换回命令行时,您也不需要
spring stop
。
This happens because if spring is not running when you run rake or whatever outside RubyMine, spring will start and will preload your code but not RubyMine-specific code. 发生这种情况是因为如果在运行rake或者RubyMine以外的任何东西时Spring没有运行,spring将启动并预加载代码而不是特定于RubyMine的代码。 Evidently spring doesn't know how to load missing code after it's been started.
显然,spring在启动后不知道如何加载丢失的代码。
I took the time to fix this without the need to restart spring. 我花时间解决了这个问题而无需重新启动弹簧。
There's a Pull Request for the quick hack I made in my fork of the spring-commands-rspec gem. 我在spring-commands-rspec gem的fork中做了一个快速入侵的Pull请求 。
But it doesn't look like that repo is active, so you can use my fix by switching your spring-commands-rspec entry to this to your Gemfile: 但它看起来不像repo是活动的,所以你可以通过将spring-commands-rspec条目切换到你的Gemfile来使用我的修复:
gem 'spring-commands-rspec', git: 'https://github.com/thewoolleyman/spring-commands-rspec.git'
HTH, :) -- Chad HTH,:) - 乍得
Had the same issue just today, and I had to take different actions: 刚才有同样的问题,我不得不采取不同的行动:
spring stop
would tell me that Spring is not running
spring stop
会告诉我Spring is not running
So I had to 所以我必须这样做
1. kill them manually 1.手动杀死他们
ps aux | grep spring
Would give me 会给我的
thomasromera 27841 [...] | spring app | started 23 hours ago | development mode
thomasromera 38931 [...] | spring app | started 18 hours ago | development mode
thomasromera 54661 [...] | spring app | started 4 mins ago | development mode
thomasromera 27840 [...] | spring server | started 23 hours ago
then kill all servers + apps 然后杀死所有服务器+应用程序
kill 27840
kill 38931
...
2. Turn off the spring pre-loader in RubyMine: 2.在RubyMine中关闭弹簧预加载器:
In RubyMine: CMD + Shift + A type spring pre-loader
, turn it off and rerun the specs. 在RubyMine: CMD + Shift + A型
spring pre-loader
,将其关闭并重新运行规范。
Don't forget to turn it on again if you need it. 如果需要,请不要忘记再打开它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.