Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 786
chylli Avatar asked Jul 02 '14 08:07

chylli


3 Answers

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

like image 45
thewoolleyman Avatar answered Nov 12 '22 15:11

thewoolleyman


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.

like image 58
Dave Schweisguth Avatar answered Nov 12 '22 14:11

Dave Schweisguth


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 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:

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.

like image 4
Erowlin Avatar answered Nov 12 '22 16:11

Erowlin