Jeff Cole wrote:> A few unit test questions:
>   a.  I found that the fixtures must be loaded in the reverse order  
> that they should be deleted, i.e.  I must specify  "fixtures :foo,
:bar"
> with :foo first, otherwise I get DB constraint  errors when the unit 
> tests try to clear out the tables.  Is this  documented anywhere?
>   b.  I found that I must include the dependent fixture, even if it  is 
> not used in my test.   For example, FooTest must include the :bar  
> fixture, or else I get the same DB constraint errors.  Is this  correct 
> behavior?
Hi,
I''ve seen that behavior too. First I found it annoying, but later I saw
the benefit from it:
- the db constraints help you find errors in your fixtures (for example 
you made a mistake specifying some non existent foo_id)
- they make you think/understand more about your db schema
- the db constraints help you identify models where you need to add 
validations (validates_presence_of and the like)
I don''t know exactly where it is documented, but I found info on it in 
the wiki (would have to search to find it right now) and in the 
mailinglist here.
regards,
Bas