apsoto-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-13 06:58 UTC
Postgres, Foriegn Key constraints causing too many fixtures to be included in tests
Hey there, Basically since we''re using postgres and have FKEY constraints on the tables, unit testing a model will require at bunch of fixtures to be included for other models. I understand why that''s needed. It just smell''s funny that I have 10 fixtures included in a unit test for a model. I''m wondering if anyone else has figured out a way around this? Is there a way to disable FKEY constraints on postgres when the db is loaded with fixtures or some other solution? Thanks, Alex --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Jeremy Kemper
2006-Sep-13 07:08 UTC
Re: Postgres, Foriegn Key constraints causing too many fixtures to be included in tests
On 9/12/06, apsoto-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <apsoto-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Basically since we''re using postgres and have FKEY constraints on the > tables, unit testing a model will require at bunch of fixtures to be > included for other models. I understand why that''s needed. It just > smell''s funny that I have 10 fixtures included in a unit test for a > model. I''m wondering if anyone else has figured out a way around this? > Is there a way to disable FKEY constraints on postgres when the db is > loaded with fixtures or some other solution?If you''re using transactional fixtures (on by default) you don''t incur the insert/delete penalty between tests, so no worries. Consider declaring all your fixtures at once in test/test_helper.rb and omitting the per-test declarations. jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---