Uninitialized constant Test (NameError)

I have three Rails apps on my laptop.

Two can runs tests just fine.

The third generates this error when I try to run any tests:

active_support/dependencies.rb:200:in `const_missing’:
uninitialized constant Test (NameError)
from ./test/unit/…/test_helper.rb:5
from ./test/unit/album_test.rb:1
from /usr/local/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake/
from /usr/local/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake/

I found this reference on Google, which seems related, but no answer
was provided:


I get the same error whether I run a single test at a time or a full
rake set.

I’ve checked config files, and all seems OK.

I’m really pulling my hair out on this. Any help would be appreciated.

– Tom M.

If you run debian or debian-based distribution like Ubuntu, make sure
that you have unit test package installed (libtest-unit-ruby).


Thanks, Kent.

Notice that 2 of 3 apps can run unit tests just fine. :slight_smile:

– Tom M.

Hey Tom,

I faced this same problem recently as well. It turns out that I had a
require in app/controllers/application.rb that wasn’t finding the file,
was causing an exception to be thrown. Somehow, this got in the way of
loading ‘test/unit.’ (Oddly enough, the tests all worked fine on
windows. It
turns out my bug was related to the fact that filenames on unix are case
sensitive, but they aren’t on windows!).

I dont think thats the exact same problem with yours, since its failing
on a
unit test, not a functional test, but it may be a similar type of error.

Try running ‘rake test_units --trace’ to see if you can find a more
error message.


Thank you so much.

That was exactly the problem.

Weird error message, that!

– Tom M.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs