individual specs don't run in jruby

If I run a spec file with jruby as the sdk it evaluates the file, but it doesn't run the spec. I.e. if I put a puts outside the spec block I can see it in the output of the run, but the spec block never gets executed. With MRI as the sdk it works fine. Is this a bug or is there some configuration I need to change.

7 comments
Comment actions Permalink

If I run a spec file with jruby as the sdk it evaluates the file, but it doesn't run the spec.

Are you sure that valid rspec gem is attached to you project in File | Settings | Ruby SDK and Gems (when jruby sdk is selected) ? Could you post a screenshot here?

0
Comment actions Permalink

I isn't attached, but it isn't attached for the mri SDK either. Does that one work differently or something?

0
Comment actions Permalink

Which MRI do you use? It seems I've reproduced it on ruby19. I've just noticed that Ruby19 interpreter adds all gems' "lib" folders in LOAD_PATH

romeo@romeo ~ $ ruby19 -e "p \$LOAD_PATH" ["/usr/local/lib/ruby19/gems/1.9.1/gems/rspec-1.2.6/bin", "/usr/local/lib/ruby19/gems/1.9.1/gems/rspec-1.2.6/lib", "/usr/local/lib/ruby19/gems/1.9.1/gems/rubygems-update-1.3.3/bin", "/usr/local/lib/ruby19/gems/1.9.1/gems/rubygems-update-1.3.3/lib", ..., "."]



 

So with Ruby19 interpreter RubyMine understands require "spec" (because "spec" file is in load path) and load code insight support. In case of Ruby18 and JRuby load path doesn't contain gems' lib folders so RubyMine cannot understand require "spec" if "rspec" gem isn't attached. Actually I don't know is such behaviour bug or feature of Ruby19. Our special support for rspec/test-spec/cucumber/rails is based on attached gems in RubyMine's Gem manager, so I recommend you to attach rspec gem to your project for both sdks.

0
Comment actions Permalink

Thanks for all the help. It works fine in jruby if I add the rspec gem as you suggested earlier so I'm just curious why I didn't need to do that with mri. It still works fine in ruby 1.8.7 without having the rspec gem added.

rubyconfig.jpg

Here you can see that the spec ran without having the rspec gem in the mri config

rubyrun.jpg

0
Comment actions Permalink

Because you executed it as ordinary ruby file using ruby interpreter.
Look at my screenshot, it is better =)
Picture 24.png

0
Comment actions Permalink

thanks again for the help

0

Please sign in to leave a comment.