Re: ActiveRecord tests for patch

Jeremy Kemper
Mon, 15 Jan 2007 00:26:36 -0000

On 1/14/07, Josh Susser <josh@hasmanythrough.com>
wrote:
>
> I''ve got a patch that fixes the problem with erroneous
> singularization of foreign keys with eager loading (#4117, #6390),
> and all the AR tests pass.  However, I don''t yet have a failing
test
> case that can be submitted as a patch (though I can easily reproduce
> it in an app).  Adding a table to the schema seems to require
> modifying ten different .sql files for all the various supported
> databases, and I''m not familiar with many of those DDL variants
and
> don''t have any way to test that I put the files together correctly
> since all I run is MySQL.  What''s a good way to proceed?
>
> Also, The amount of test code I''m going to have to create for this
> issue is relatively large - five classes, six tables, and at least
> five test cases.  Is that overkill?  Is complete coverage on negative
> tests required here?  This situation is particularly gross because it
> requires using names which have singular forms that can be
> singularized, but there are very few that give semantically friendly
> examples and aren''t already used in the tests.  I could use
nonsense
> names, though that seems aesthetically unpleasing.  Or, if someone
> could advise me how to use custom inflections in AR tests I could go
> that way.


You can add tables to test/fixtures/db_definitions/schema.rb or AR::
Base.connection.create_table in setup and drop_table in teardown if
connection.supports_migrations?

Having to rely on the existing tables does frustrate new tests. Creating new
tables and classes on the fly is probably the simplest option, considering
the new tables are for these tests in particular.

jeremy

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---