Forum: Ruby on Rails uninitialized constant Test (NameError)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Tom M. (Guest)
on 2006-02-02 11:50
(Received via mailing list)
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:

> /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/
> 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/
> rake_test_loader.rb:5
>         from /usr/local/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake/
> rake_test_loader.rb:5

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

http://wrath.rubyonrails.org/pipermail/rails/2006-...

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.
Kent S. (Guest)
on 2006-02-02 20:11
(Received via mailing list)
If you run debian or debian-based distribution like Ubuntu, make sure
that you have unit test package installed (libtest-unit-ruby).

Kent.
Tom M. (Guest)
on 2006-02-02 21:08
(Received via mailing list)
Thanks, Kent.

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

--
-- Tom M.
Maurice Codik (Guest)
on 2006-02-02 21:35
(Received via mailing list)
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,
and
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
useful
error message.

Maurice
Tom M. (Guest)
on 2006-02-03 02:19
(Received via mailing list)
Thank you *so* much.

That was *exactly* the problem.

Weird error message, that!

--
-- Tom M.
This topic is locked and can not be replied to.