Spring and Rspec broken in latest Rubymine version

Answered

Hi,

Problem :

When i run a rspec test i get a "cannot load such file -- teamcity/spec/runner/formatter/teamcity/formatter (LoadError)"

If i run the same test in debug mode it works.

Steps to reproduce :

- Start Rubymine

- Clic run rspec

 

More info :

Untill i updated to Rubymine 2016.2.1 i used to have this error randomly. I was able to solve it by killing spring in the console (`spring stop`) => http://stackoverflow.com/questions/24525945/running-a-spec-in-rubymine-results-in-cannot-load-such-file-teamcity-spec-ru

Since i updated Rubymine this doesn't work anymore. I cant run rspec anymore unless i use debug mode even if i disable spring in the run configuration (use pre-load server: none)

Right now i'm forced to run the spec outside of rubymine in the terminal which is a huge pain :(

What can i do to run the rspec without debug mode ?

 

Config :

 

  • RubyMine 2016.2.1 - Build #RM-162.1447.29
  • Ruby 2.3.1p112
  • rails 4.2.6
  • spec-rails (3.4.0)
  • OSX 10.11.6

 

 

Here is my run configuration : 

Thanks for this amazing tool by the way :)

Vincent

10 comments
Comment actions Permalink

Hello, Vincent,

could you please try stopping spring manually (by running spring stop). How does it go in this case?

0
Comment actions Permalink

Same issue here.  

 

Even after I manually stop spring with spring stop, I have the same errors.

 

When I run rspec outside of RubyMine, it's fine. (ex:  > bundle exec rspec  )

0
Comment actions Permalink

@Ashley,

could you please specify what RubyMine version you're using (there was a similar issue, which is already fixed: https://youtrack.jetbrains.com/issue/RUBY-18207)

0
Comment actions Permalink

yes, i confirm that latest update solved the problem for me.

0
Comment actions Permalink

After upgrading IntelliJ IDEA to 2019.1 - this issue came again.

Now I cannot run rspec tests because it shows the following:

I see in the console that IntelliJ starts the rspec test with the following command line:

/bin/bash -c "/Users/maris/.rvm/bin/rvm ruby-2.4.5 do bundle exec /Users/maris/.rvm/rubies/ruby-2.4.5/bin/ruby /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/bin/rspec /Users/maris/Documents/Code/app/spec/my-test_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter --example \"My Test\""

It shows that test has (-) finished but with no result.

If I try to run the same command in the command line, I see the following output:

An error occurred while loading teamcity/spec/runner/formatter/teamcity/formatter.
Failure/Error: load_dependency(file) { result = super }

LoadError:
cannot load such file -- teamcity/spec/runner/formatter/teamcity/formatter
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/configuration.rb:2034:in `load_file_handling_errors'
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/configuration.rb:1519:in `block in requires='
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/configuration.rb:1519:in `each'
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/configuration.rb:1519:in `requires='
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/configuration_options.rb:113:in `block in process_options_into'
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/configuration_options.rb:112:in `each'
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/configuration_options.rb:112:in `process_options_into'
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/configuration_options.rb:22:in `configure'
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:127:in `configure'
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:97:in `setup'
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:86:in `run'
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:71:in `run'
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:45:in `invoke'
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/exe/rspec:4:in `<top (required)>'
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/bin/rspec:23:in `load'
# /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/bin/rspec:23:in `<main>'
#
# Showing full backtrace because every line was filtered out.
# See docs for RSpec::Configuration#backtrace_exclusion_patterns and
# RSpec::Configuration#backtrace_inclusion_patterns for more information.
/Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require': cannot load such file -- spec/runner/formatter/teamcity_formatter (LoadError)
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters.rb:231:in `rescue in custom_formatter'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters.rb:228:in `custom_formatter'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters.rb:181:in `find_formatter'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/formatters.rb:150:in `add'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/configuration.rb:942:in `add_formatter'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/configuration_options.rb:118:in `block in load_formatters_into'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/configuration_options.rb:118:in `each'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/configuration_options.rb:118:in `load_formatters_into'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/configuration_options.rb:24:in `configure'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:127:in `configure'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:97:in `setup'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:86:in `run'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:71:in `run'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/lib/rspec/core/runner.rb:45:in `invoke'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/gems/rspec-core-3.8.0/exe/rspec:4:in `<top (required)>'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/bin/rspec:23:in `load'
from /Users/maris/.rvm/rubies/ruby-2.4.4/gems/ruby/2.4.0/bin/rspec:23:in `<main>'

 

Question:

1. Why is IntelliJ adding the parameters

--require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter

to the rspec command?

2. How to fix this?

 

Stopping spring, killing spring, restarting IntelliJ, restarting computer - nothing helps.

 

Loving the IntelliJ by the way!

0
Comment actions Permalink

Hello,

that appears to be a known issue: https://youtrack.jetbrains.com/issue/RUBY-23459

The fix will be most likely available in RubyMine 2019.1.1 and in the updated Ruby plugin for IDEA 2019.1.1

0
Comment actions Permalink

I have the same problem in latest IntelliJ version.

Ruby 2.7.1, Rspec 3.8.2

Is there any workaround?

Testing started at 1:46 p.m. ...
/bin/zsh -c "bash -c 'env RBENV_VERSION=2.7.1 /usr/local/Cellar/rbenv/1.1.2/libexec/rbenv exec ruby /Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/ruby-debug-ide-0.8.0.beta24/bin/rdebug-ide --key-value --step-over-in-blocks --disable-int-handler --evaluation-timeout 10 --evaluation-control --time-limit 100 --memory-limit 0 --rubymine-protocol-extensions --port 57308 --host 0.0.0.0 --dispatcher-port 57309 -- /Users/ymikhailenko/.rbenv/versions/2.7.1/bin/rspec /Users/ymikhailenko/IdeaProjects/moltin/repos/moltin/payments.svc.molt.in/src --require teamcity/spec/runner/formatter/teamcity/formatter --format '\"'\"'Spec::Runner::Formatter::TeamcityFormatter'\"'\"' --pattern '\"'\"'**/*_spec.rb'\"'\"''"
Fast Debugger (ruby-debug-ide 0.8.0.beta24, debase 0.3.0.beta34, file filtering is supported, block breakpoints supported, smart steps supported, obtaining return values supported, partial obtaining of instance variables supported) listens on 0.0.0.0:57308
Uncaught exception: cannot load such file -- rspec/core/formatters/progress_formatter
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/formatters.rb:210:in `require'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/formatters.rb:210:in `built_in_formatter'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/formatters.rb:180:in `find_formatter'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/formatters.rb:150:in `add'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/formatters.rb:125:in `setup_default'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/reporter.rb:47:in `block in prepare_default'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/reporter.rb:228:in `ensure_listeners_ready'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/reporter.rb:199:in `notify'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/reporter.rb:92:in `message'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/reporter.rb:161:in `notify_non_example_exception'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/configuration.rb:2056:in `rescue in load_file_handling_errors'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/configuration.rb:2052:in `load_file_handling_errors'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/configuration.rb:1519:in `block in requires='
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/configuration.rb:1519:in `each'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/configuration.rb:1519:in `requires='
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/configuration_options.rb:113:in `block in process_options_into'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/configuration_options.rb:112:in `each'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/configuration_options.rb:112:in `process_options_into'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/configuration_options.rb:22:in `configure'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/runner.rb:127:in `configure'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/runner.rb:97:in `setup'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/runner.rb:86:in `run'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/runner.rb:71:in `run'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/lib/rspec/core/runner.rb:45:in `invoke'
/Users/ymikhailenko/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rspec-core-3.8.2/exe/rspec:4:in `<top (required)>'
/Users/ymikhailenko/.rbenv/versions/2.7.1/bin/rspec:23:in `load'
/Users/ymikhailenko/.rbenv/versions/2.7.1/bin/rspec:23:in `<top (required)>'
SimpleCov failed with exit 1
Coverage report generated for RSpec to /Users/ymikhailenko/IdeaProjects/moltin/repos/moltin/payments.svc.molt.in/src/coverage. 0 / 302 LOC (0.0%) covered.

Process finished with exit code 1
0
Comment actions Permalink

Yury Mikhailenko, that doesn't look like the problem mentioned in the thread (there're different formatters in the stacktrace). Does it fail only with Spring? How does it go in case you launch RSpec tests manually from the Terminal?

0
Comment actions Permalink

Olga Kuvardina I think you're right and this is different issue.

bundle exec rspec

works just fine for me, but I cannot enable bundler via run configuration in IntelliJ. It always complains about Gemfile missing, though it's right there - in the project dir.

0
Comment actions Permalink

I'm having a similar issue, working on windows with wsl2 and RubyMine 2020.2, I cannot run my specs from the IDE. if I just type in the console:

bundle exec rspec spec/models/user_spec.rb

then it works, but I run it form RubyMine, I get:

 `require': cannot load such file -- rspec/core/formatters/fallback_message_formatter (LoadError)


I also cannot run my rake tasks from the IDE, they don't appear, and when I click on rake --tasks, nothing happens. If I type bin/rake --tasks in the console, it works.

0

Please sign in to leave a comment.