trouble running rspecs with bundler in RubyMine

My setup: Mac OS X snow leopard with REE 1.8.7 and bundler installed.

Trying to run rspecs from RubyMine, getting the following error:

/opt/ruby-enterprise-1.8.7-2011.03/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/msherman/.gem/ruby/1.8/bin/rspec /Users/msherman/Projects/buzzhubs/daily_buzz/spec/requests/home_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter
Testing started at 10:29 AM ...
/opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/rubygems_integration.rb:143:in `gem': rspec-core is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
 from /Users/msherman/.gem/ruby/1.8/bin/rspec:18
 from -e:1:in `load'
 from -e:1


I am using bundler, so I need to run "bundle exec" rspec.

I've checked the "Run in the script in the context of the bundle" checkbox in the config, but it doesn't seem to be working.

Any advice would be greatly appreciated!
4 comments
Comment actions Permalink

I should mention that this project was NOT created with RubyMine.

My tests run fine from the command line with "bundle exec rspec spec".

Thanks again...

0
Comment actions Permalink

I should mention that this project was NOT created with RubyMine.

It doesn't matter

Trying to run rspecs from RubyMine, getting the following error:


/opt/ruby-enterprise-1.8.7-2011.03/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/msherman/.gem/ruby/1.8/bin/rspec /Users/msherman/Projects/buzzhubs/daily_buzz/spec/requests/home_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter
Testing started at 10:29 AM ...
/opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/rubygems_integration.rb:143:in `gem': rspec-core is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
from /Users/msherman/.gem/ruby/1.8/bin/rspec:18
from -e:1:in `load'
from -e:1


I am using bundler, so I need to run "bundle exec" rspec.

I've checked the "Run in the script in the context of the bundle" checkbox in the config, but it doesn't seem to be working.

Any advice would be greatly appreciated!

Could you prepare some minimal test case? E.g. create a project with only one spec test and Gemfile, then try to launch spec test with RubyMine. Also which RubyMine version do you use?

0
Comment actions Permalink

I solved the problem. I had to switch to opening only one project directory at a time (my project had multiple ruby apps under one "master" folder) and install the rspec-rails gem in the Ruby SDK and Gems prefs panel. I still don't think RubyMine is using "bundle exec" though. (?)

I am using RubyMine 3.2.4.

0
Comment actions Permalink

and install the rspec-rails gem in the Ruby SDK and Gems prefs panel

Probably you are using different ruby sdks in terminal and in RubyMine project settings

I solved the problem. I had to switch to opening only one project directory at a time (my project had multiple ruby apps under one "master" folder)

Yes, you need to open each ruby app as different project. If you have some main project and several shared ruby lib dirs you may add them as additonal content roots in Project Settings, but only one Rails application (in first content root) per project is supported.

I still don't think RubyMine is using "bundle exec" though. (?)

You can print program environment variables and check that BUNDLE_BIN_PATH and BUNDLE_GEMFILE variables are set.

0

Please sign in to leave a comment.