Rspec is not working in rubymine

Answered

Hi.
I am not able to run rspec tests in rubymine.

I have osx and last stable version of rubymine.
If i run rspec "path_to_test" it is working.

/Users/myname/.rbenv/shims/bundle exec ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/myname/Documents/w-personalpage/bin/spring rspec /Users/myname/Documents/w-personalpage/spec/registration_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter --example RegistrationController
Could not find command "rspec".

I set "use preloaded server" to none:
/Users/myname/.rbenv/shims/bundle exec ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/myname/Documents/w-personalpage/bin/rspec /Users/myname/Documents/w-personalpage/spec/registration_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter --example RegistrationController
Could not find command "/Users/myname/Documents/w-personalpage/spec/registration_spec.rb".

 

Please can you help me? It is really annoying and slow when I need run tests a type path for test by my self in console.

 

6 comments
Comment actions Permalink

IT has problem to work with rbenv.

I must set "Use custom RSpec runner script" and set it on"/Users/me/.rbenv/versions/2.5.0/bin/rspec" instead of "/Users/me/.rbenv/shims/rspec".

It is even not possible to use bin/rspec file in our project which is generated by bundler.

0
Comment actions Permalink

No one? :( It is really annoying

0
Comment actions Permalink

Hello,

sorry for the delay. Could you please specify what RubyMine version you're using. In addition, how do you run Rspec tests (all the spec tests in folder or single tests) and does it happen to all your projects?

0
Comment actions Permalink

Have you tried updating your binstubs?

I had the same issue and this has resolved it for me:

bundle binstubs bundler --force
1
Comment actions Permalink

Since this is one of the most recent of many similar support requests, I'll chime in here.

RubyMine 2018.3 does still not find the "RSpec runner script" even though I've definitely have installed the gem (as system gem). There's nothing even written to the log. :/ It seems that RubyMine is just looking in the wrong place(s).


Workaround: in the run configuration, manually set the "custom" RSpec runner script to whatever `which rspec` returns on the shell for you (no idea how Windows does it).

1
Comment actions Permalink

I was originally getting an error stating that Spring `Could not find command "rspec"`
Poking around I've added `DISABLE_SPRING=1` to my Environment Variables which has helped but now the `spec.rb` is being run as a command which also fails =( 

`Could not find command "<path/to/spec>_spec.rb".`

Anyone getting anywhere with this?

UPDATE

Managed to fix this by passing `-Ilib -Ispec -rrspec/autorun` as Ruby arguments!
Tests are now working - albeit failing

0

Please sign in to leave a comment.