HABTM testing - fixtures not loading?

Hi,

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 :expressionless: 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 F.

Look in your test logs to see what is happening when you are running
your
tests with rake. If you have constraints on your database tables these
could
be causing problems when the tests are loading. Tests load differently
using
rake compared to running directly from the command line. If this is the
case
see:
http://wiki.rubyonrails.org/rails/pages/DisableForeignKeyChecksUnderMySql