1

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:

.../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 ...

rene
  • 41,474
  • 78
  • 114
  • 152
ontk
  • 942
  • 1
  • 10
  • 24

2 Answers2

0

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:

Community
  • 1
  • 1
Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
  • Thank you Andrew, sorry for the late reply. I looked around and found the same questions as the ones you listed. Unfortunately, they did not help me. Thank you though. – ontk May 21 '11 at 04:13
0

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.

Kelvin
  • 20,119
  • 3
  • 60
  • 68
  • Hi Kelvin, here is what I get when running the cmd: #!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby I was running the cmd from the edge rails guide ruby -Itest test/unit/club_test.rb. However, running rake test:unit and so on work fine. I guess I will just stick to that. Thanks for your help! – ontk May 21 '11 at 04:14