Error on running unity test: "no such file to load -- 'active_record/version'"

Hi folks!

I've been experimenting an error messagem when I try to run unity test in any model of my project.

Here it is:

/home/fabricio/shopcell/config/environment.rb:1:in `require': no such file to load -- active_record/version (LoadError)   from /home/fabricio/shopcell/config/environment.rb:1   from ./test/test_helper.rb:2:in `require'   from ./test/test_helper.rb:2   from test/unit/client_test.rb:1:in `require'   from test/unit/client_test.rb:1

My application runs smoothly, but I get stuck on this only when trying running tests. I know that the statement "require 'active_record'" works when I run the applications because if I remove this statement fom 'environment.rb' my server (Mongrel) doesn't even run.

Have anybody an idea of what's going on?

My system: UBUNTU 10.04 RUBY 1.87 RUBYGEMS 1.3.7 RAILS 2.2.2

Thanks in advance!

Fabrício

My application runs smoothly, but I get stuck on this only when trying running tests. I know that the statement "require 'active_record'" works when I run the applications because if I remove this statement fom 'environment.rb' my server (Mongrel) doesn't even run.

Have anybody an idea of what's going on?

So what's in config/environment.rb then?

Fred

Hi, Fred!

Thanks for your resonse.

My config/environment.rb has that exact line:

"require 'active_record/version'"

Fabrício

Hi, Fred!

Thanks for your resonse.

My config/environment.rb has that exact line:

"require 'active_record/version'"

I should rephrase that - what else is in your environment.rb ? None of mine have that line and it shouldn't be needed since activerecord will get loaded as part of the rails initialisation process (and that line could in fact screw things up if it is run before rubygems has been loaded)

Fred

Here it goes, Fred:

You should probably stick it after the line requires boot.rb - that way the rails gems should already be on the load path

Fred

FIXED!

I've moved the statement to a line right after the boot.rb requirement and now I'm able to run my tests now with no problems.

Thanks, Fred!