On Mon, Dec 28, 2009 at 10:55 AM, Marnen Laibow-Koser
<[email protected]> wrote:

>> If I use a generator to create test objects and owners, I have no
>> idea what owner ids have been created, so how can I specify an
>> invalid one for test purposes?
>
> You probably don't need to.  But a couple of ideas come to mind:
> * User.max(:id) + 10

That didn't work but got me thinking in a workable direction, thanks.

>  ... validates_associated is silly and circularity-prone.
> You should be using foreign key constraints in the DB for this

Well, I'll take that under advisement :-) but I would prefer to have the
business logic in the app, and tested. Even if (as in this case) it's not
actually TDD/BDD because I'm adding tests to someone else's code,
the test suite now reflects intent -- better than the usual (which is to
say no) documentation thereof.

Thanks,
-- 
Hassan Schroeder ------------------------ [email protected]
twitter: @hassan

--

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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to