But the difference here is that has_many is named explicitly. The
TestInjector (while cool, don't get me wrong) feels a bit like PFM to
save 3 lines in a setup method. It also encourages a 1 class to 1 test
case method of testing which I don't think always makes the most sense
(see 
http://glu.ttono.us/articles/2006/08/07/why-fixtures-suck-and-how-we-can-fix-them
for more on that).

On 8/18/06, Keith Morrison <[EMAIL PROTECTED]> wrote:
Rails does a great job of inferring a lot of things based on names, so
it seems like a good fit to me.

class User < ActiveRecord::Base
    has_many :assignments
end

 From this class declaration, Rails infers that there is an Assignment
model that contains the foreign key user_id.  Isn't this the same kind
of "magic" we are talking about?

Kevin Clark wrote:
> See ActiveRecordTestCase in active_record_unit.rb in actionpack. I
> defined a test_truth so Test::Unit::TestCase doesn't complain. The
> test count is slightly inflated, but if you care enough about not
> having request, response and controller instance variables setup then
> it's an option.
>
> Adding a default method is certainly less magic than guessing the
> controller name.
>
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core



--
Kevin Clark
http://glu.ttono.us
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to