Forum: Ruby on Rails HABTM testing - fixtures not loading?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
5b132632f47e8c7e2a83157cef4649c8?d=identicon&s=25 Agnieszka Figiel (agnessa)
on 2006-02-23 13:30

I have a strange problem with testing classes which have a HABTM
relation. It seems that while running my tests with rake the fixture for
the association table is not loaded - as a result I get a failure on a
test which simply checks the number of associated elements - it says
it's 0 although there should be one. The weird thing is that when I run
the tests with rcov there's no failure :| Also, when I do script/console
"test" I can see that the association gets loaded and the same code that
fails in the test works.

Anybody seen something like this?

Agnieszka Figiel
85d99e7678d8720f6e00ab0f60fe6ea9?d=identicon&s=25 Andrew Premdas (Guest)
on 2006-02-23 14:49
(Received via mailing list)
Look in your test logs to see what is happening when you are running
tests with rake. If you have constraints on your database tables these
be causing problems when the tests are loading. Tests load differently
rake compared to running directly from the command line. If this is the
This topic is locked and can not be replied to.