Hi all,
I’ve been playing around with Rails off and on for a while now, and
suddenly I am unable to run any unit tests of any kind under Rails. Or
perhaps more specifically, using the Rake task test_units in a rails
project. This applies to any rails project I create. Unit tests,
functional tests, etc. I swear I used to be able to run tests, but
now I can’t, and cannot for the life of me figure out why.
I am on Windows XP, not running under Cygwin, but this has never
been a problem before, running Ruby 1.8.4-20 and Rails 1.2.3 to mirror
what my host provider has. The RoR website says 1.8.4 is still viable
with the latest Rails release, so I assume this is not an
incompatibility issue. I am also using Rake 0.7.3 as installed when
installing the Rails gem, though 0.7.1 was already installed by
default.
For this example, I created a barebones Rails app called “example” and
tried to test, using these steps:
== begin snippet ==
dir> rails example
… generated project
dir> ruby script\generate model Foo
… generated model and foo_test.rb
dir> rake test_units
(in C:/Dev/projects/rails/example)
C:/Dev/languages/ruby/1.8.4-20/bin/ruby -Ilib;test “C:/Dev/languages/
ruby/1.8.4-20/lib/ruby/gems/1.8/gems/rake-0.7.3/lib
/rake/rake_test_loader.rb” “this is test in process”
C:/Dev/languages/ruby/1.8.4-20/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/
rake/rake_test_loader.rb:5:in `load’: no such file
to load – this is test in process (LoadError)
from C:/Dev/languages/ruby/1.8.4-20/lib/ruby/gems/1.8/gems/
rake-0.7.3/lib/rake/rake_test_loader.rb:5
from C:/Dev/languages/ruby/1.8.4-20/lib/ruby/gems/1.8/gems/
rake-0.7.3/lib/rake/rake_test_loader.rb:5
rake aborted!
Command failed with status (1): [C:/Dev/languages/ruby/1.8.4-20/bin/
ruby -I…]
(See full trace by running task with --trace)
== /end snippet ==
Here’s the really weird part: I cannot find ANY trace of the phrase
“this is test in process” or even “test in process” anywhere in (a)
Rails, (b) Ruby, © any Ruby gems. Nor can I find either phrase
anywhere via Google in any way related to Rails (or even Ruby) unit
testing.
If I manually run the default unit test, it works FINE:
== begin snippet ==
test\unit> ruby foo_test.rb
Loaded suite foo_test
Started
.
Finished in 0.203 seconds.
1 tests, 1 assertions, 0 failures, 0 errors
== /end snippet ==
I tried assuming that “this is test in process” is something that
perhaps I wound up adding or modifying in my tinkering, so I did the
following:
- Removed Rails and re-installed. Didn’t work.
- Completely removed Ruby and Ruby gems, and re-installed both, then
re-installed Rails. Didn’t work.
I am now completely stumped. Has anyone run into this behavior before,
or otherwise know why this is happening and (more importantly) what I
can do to get the rake task running again?
Thanks in advance,
-dave