Getting RSpec tests to run - fails with no such file to load spec/autorun

I generated a test template in Rubymine and cannot get it to run in the IDE. If i run 'rspec' from command line, I see the output of the test as expected.
In the IDE I'm getting an error of: "MYAPP_PATH/script/spec:9:in `require': no such file to load -- spec/autorun (LoadError)"

In the test configuration I have:
'rspec' gem: [default]
Use DRb server
Working Directory: my rails app root
Use project SDK
Bundler Tab: Run the script in context of the bundle

I also have Spork DRb server running from within Rubymine.

Please help!

Comment actions Permalink

Perhaps the behavior you see the same as described in
If this is the case try to add all necessery -I options to "Runner options"

Regards, Oleg.

Comment actions Permalink

Thanks for taking the time to reply Oleg.

I added '-I' to the Runner options field, and still have the same results. I noticed a difference between my outputted command and the one referenced in the link you provided. Mine just appends the -I at the end and doesn't have the word 'test' appended to it.

My output:
/home/mackerman/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /home/mackerman/rails_apps/myapp/script/spec /home/mackerman/rails_apps/myapp/spec/my_example_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter --example "My behaviour should do something" --drb --backtrace -I

Does this help?


Comment actions Permalink

Hi Mike,

w/o the code it is hard to say what is wrong, but I've found the following message in rspec-core/exe/rspec:

  Could not find 'rspec/autorun'

  This may happen if you're using rubygems as your package manager, but it is not
  being required through some mechanism before executing the rspec command.

  You may need to do one of the following in your shell:

    # for bash/zsh
    export RUBYOPT=rubygems

    # for csh, etc.
    set RUBYOPT=rubygems

  For background, please see

Perhaps this is what you have

Regards, Oleg.
Comment actions Permalink

That didn't work :(

However I was able to get an example test to run! I removed my script/spec file, removed the spec_helper.rb, re-ran the Generator (rspec:install), removed gem 'rspec' from my Gemfile (also had 'rspec-rails').

Just thought I'd post what I did to make it work.  Not really a direct solution to the posted problem...

Comment actions Permalink

Perfect! Made my day! (same thing worked for me. thanks a lot!)


Please sign in to leave a comment.