rspec 2.2.0 in rubymine 3.0: "No such file or directory -- rspec"

I recently upgraded to rubymine 3.0. Everything has been going fine until I decided to update my rspec version (from 1.2.9 to 2.2.0). I'm using ruby 1.9.1 (ruby 1.9.1p430 (2010-08-16 revision 28998) [i386-mingw32]). In the process of moving to rspec 2.2.0, I had to refactor the rake tasks for my rspec tests to use RSpec::Core::RakeTask instead of Spec::Rake::SpecTask. After the refactoring, the refactored rspec tasks in my rakefile will run from the command line but won't run inside Rubymine. To test my migration, I have a simple task (called "sandbox") running a generic test, which works fine from the command line, like so:


d:\workspace\trunk>rake sandbox --trace
(in d:/workspace/trunk)
** Invoke sandbox (first_time)
** Execute sandbox
C:/Ruby191/bin/ruby.exe -S rspec "./Sandbox.rb"
.
Finished in 0 seconds
1 example, 0 failures
d:\workspace\trunk>



Running the exact same code, through rubymine 3 (using a rake run configuration calling the "sandbox" task), results in this:

C:\Ruby191\bin\ruby.exe C:\Ruby191\bin/rake sandbox --trace
C:/Ruby191/bin/ruby.exe -S rspec "./Sandbox.rb"
C:/Ruby191/bin/ruby.exe: No such file or directory -- rspec (LoadError)
rake aborted!
ruby -S rspec "./Sandbox.rb" failed
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rspec-core-2.2.1/lib/rspec/core/rake_task.rb:139:in `rescue in block (2 levels) in initialize'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rspec-core-2.2.1/lib/rspec/core/rake_task.rb:135:in `block (2 levels) in initialize'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:1112:in `verbose'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rspec-core-2.2.1/lib/rspec/core/rake_task.rb:131:in `block in initialize'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `call'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `each'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
C:/Ruby191/lib/ruby/1.9.1/monitor.rb:190:in `mon_synchronize'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
C:/Ruby191/lib/ruby/gems/1.9.1/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
C:/Ruby191/bin/rake:19:in `load'
C:/Ruby191/bin/rake:19:in `<main>'
(in D:/workspace/trunk)
** Invoke sandbox (first_time)
** Execute sandbox

Process finished with exit code 1


I can't find anyone reporting similar issues, and can't see any problems in my configuration. Rubymine seems to be doing something behind the scenes that prevents it from finding my rspec (which is there, as I confirmed by looking at the files, and as is obvious by the fact that the tests run from the command line).

Anyone got any ideas?
6 comments
Comment actions Permalink

Some further info:
I can get around this problem by setting rspec_path for each rspec task, but this is not a workable solution for me.
When I do get the rake task running by setting the rspec_path, if I attach the Rubymine RSpec test runner it tells me "No tests were found"

It seems rubymine is doing some manipulation of rspec settings behind the scenes.

0
Comment actions Permalink

Unfortunately cannot reproduce it on my Mac. I'll try it on some windows machine.

ruby -S rspec "./Sandbox.rb" failed

-S option looks for "rspec" script in system PATH. Please print your actual Path value using debug output. Let's compare them in case of RubyMine and console

0
Comment actions Permalink

Ok, that was enough for me to figure it out. I have multiple ruby instances on my machine, and my ruby 1.9.1 is not yet added by default to PATH. I can get this working by setting RUBYLIB to the bin directory of my ruby 1.9.1 install. Thanks!

[The command prompt I was running from is a 1.9.1 specific prompt (it gets installed when you install ruby 1.9.1), so that already has all the PATH stuff pointing to 1.9.1.]

0
Comment actions Permalink

Thanks,

We've improved RubyMine run configurations launcher and in next builds it will prepend interpreter and gempath bin folder to system PATH

0
Comment actions Permalink

Correction: it's the RUBYPATH env variable I have to set to get this to work as described above, not RUBYLIB.

0
Comment actions Permalink

As far as I understand it is enough to correct "Path" (or "PATH" on unix systems) env variables.

0

Please sign in to leave a comment.