On 9/12/07, Nanyang Zhan
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> I have written methods to create/drop tables and add/remove columns of
> these tables. This methods will return true/nil depending whether an
> error is raised.
AR already has methods to create/drop tables, columns, etc. Are you
re-inventing the wheel?
>
> I''d like to test these methods, however, when the first time
autotest
> runs, it return a normal report, but later it repeats "uninitialized
> constant Test (NameError)".
>
> This problem may be caused as the test database has been changed by
> those database table manipulation methods, for example, while a table is
> created from the test code itself, the second time this test,which try
> to add a table with the same name, causes test fails.
autotest isn''t expecting DDL to be going on in your tests, so it
doesn''t do the "rake db:test:prepare" step before running
each test
(or ever, for that matter, which is why you need to run it yourself
after a migration, etc.). That would really slow autotest down.
I guess the short answer would be to use the setup and/or teardown
methods in your test cases to make sure the database is in a known
state.
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---