Ruby-on-rails – Running a spec in RubyMine results in “cannot load such file — teamcity/spec/runner/formatter/teamcity/formatter (LoadError)”

rspecrubyruby-on-railsruby-on-rails-4rubymine

OS: Arch Linux, Rails version: 4, RubyMine: 6.3

When I run a spec from Tools – Run Rake Task – spec I always get this error:

/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)

but it is OK to run 'debug spec:models'.

What I tried: I added 'ruby arguments' under Run – edit configurations:

-I$RUBYMINE_HOME/rb/testing/patch/bdd -I$RUBYMINE_HOME/rb/testing/patch/common

but it doesn't work.

Best Answer

Run

spring stop

on the command line before running rake from RubyMine, or running specs directly, or doing anything else that uses 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. You also don't need to spring stop when you switch from RubyMine back to the command line.

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. Evidently spring doesn't know how to load missing code after it's been started.

Related Topic