Running a spec in RubyMine results in "cannot load such file -- teamcity/spec/runner/formatter/teamcity/formatter (LoadError)" Running a spec in RubyMine results in "cannot load such file -- teamcity/spec/runner/formatter/teamcity/formatter (LoadError)" ruby ruby

Running a spec in RubyMine results in "cannot load such file -- teamcity/spec/runner/formatter/teamcity/formatter (LoadError)"


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.


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.

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:

gem 'spring-commands-rspec', git: 'https://github.com/thewoolleyman/spring-commands-rspec.git'

HTH, :)-- Chad


Had the same issue just today, and I had to take different actions:

spring stop would tell me that Spring is not running

So I had to

1. kill them manually

ps aux | grep spring

Would give me

thomasromera     27841   [...] | spring app    | started 23 hours ago | development modethomasromera     38931   [...] | spring app    | started 18 hours ago | development modethomasromera     54661   [...] | spring app    | started 4 mins ago | development modethomasromera     27840   [...] | spring server | started 23 hours ago

then kill all servers + apps

kill 27840kill 38931...

2. Turn off the spring pre-loader in RubyMine:

In RubyMine: CMD+Shift+A type spring pre-loader, turn it off and rerun the specs.

Don't forget to turn it on again if you need it.