Unable to run tests in a rails app due to rubygems (LoadError)
I am trying to run some basic tests in my rails app following the edgeguides.
My rails app is working fine, it's only when trying to run the tests.
When running a test, I get:
.开发者_如何学Go../config/boot.rb:1:in `require': no such file to load -- rubygems (LoadError)
from /Users/olivier_ntk/Sites/tennis/config/boot.rb:1
from /Users/olivier_ntk/Sites/tennis/config/application.rb:1:in `require'
from /Users/olivier_ntk/Sites/tennis/config/application.rb:1
from /Users/olivier_ntk/Sites/tennis/config/environment.rb:2:in `require'
from /Users/olivier_ntk/Sites/tennis/config/environment.rb:2
from ./test/test_helper.rb:2:in `require'
from ./test/test_helper.rb:2
from test/unit/club_test.rb:1:in `require'
from test/unit/club_test.rb:1
$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10]
$ rails -v
Rails 3.0.6
$ gem -v
1.3.7
However, when I run which -a ruby
, I get:
/opt/local/bin/ruby
/opt/local/bin/ruby
/opt/local/bin/ruby
I am not sure why I get 3 lines and if that is affecting calling ruby ...
What command are you using to start the tests? Try using "rake test" from your app's main directory (in your case that seems to be "/Users/olivier_ntk/Sites/tennis").
If you're already doing that, run:
head -1 `which rake`
and reply with what ruby path you see.
Try typing in gem env
for more details.
I tried seeing if this question has been asked before. I don't think the following have the exact same problem as you do, but they may help you uncover what the problem is, or you may want to look for questions listed under "related" to these questions:
- no such file to load -- rubygems (LoadError)
- ruby gem not found although it is installed
- Error loading rubygems
精彩评论