Hi. I''ve got an app evolving that has just a few tables, but there are some many to many relationships that are being expressed in the database as well as in the model classes. The problem I''m finding is that I have to include fixtures for all of my tables in every single test. I *think* this is because the tests don''t clean up after themselves, so other when a second test tries to delete rows that are referenced from rows left over from the first test, it throws foreign key constraints. I can''t be the first to have come up against this. Anybody have any advice as to how to make this work without including every single fixture in every single test (which is VERY time consuming)? Thanks, David
Hello David, David Chelimsky said the following on 2005-08-23 08:38:> I can''t be the first to have come up against this. Anybody have any > advice as to how to make this work without including every single > fixture in every single test (which is VERY time consuming)?Two things you can do: 1. If you''re on MySQL, you can "SET FOREIGN_KEY_CHECKS = 0;"[1], which will disable foreign key checks; 2. Use transactionnal fixtures[2]; There is also a page on the Wiki[3] which is not yet filled in that could discuss this. Enjoy ! François [1] dev.mysql.com/doc/mysql/en/innodb-foreign-key-constraints.html [2] api.rubyonrails.com/classes/Fixtures.html [3] wiki.rubyonrails.com/rails/show/Howto+Use+Fixtures+with+habtm
Merci! François Beausoleil wrote:> Hello David, > > David Chelimsky said the following on 2005-08-23 08:38: > >> I can''t be the first to have come up against this. Anybody have any >> advice as to how to make this work without including every single >> fixture in every single test (which is VERY time consuming)? > > > Two things you can do: > 1. If you''re on MySQL, you can "SET FOREIGN_KEY_CHECKS = 0;"[1], which > will disable foreign key checks; > 2. Use transactionnal fixtures[2]; > > There is also a page on the Wiki[3] which is not yet filled in that > could discuss this. > > Enjoy ! > François > > [1] dev.mysql.com/doc/mysql/en/innodb-foreign-key-constraints.html > [2] api.rubyonrails.com/classes/Fixtures.html > [3] wiki.rubyonrails.com/rails/show/Howto+Use+Fixtures+with+habtm > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > lists.rubyonrails.org/mailman/listinfo/rails >