When testing Ruby on Rails, every so often you’ll find that rake fails in testing while running a test directly succeeds. How frustrating!
The crux of the problem is typically a missing fixture in the test class. What happens is that the data from your missing fixture is loaded in the test database, masking the problem when running a test individually. Since the order of operations on a rake test is clearly different than running a test singularly, there is a good chance that the data your test depends on simply is not loaded during the rake process. Unless you add that missing fixture, of course.
One more reason to learn the best methods of writing tests without fixtures.