Hi All I need lots of help in figuring out how to test legacy ActiveRecord data models. Here are my constraints: 1. Almost all of my models have set_table_name, set_primary_key etc and HABTM. 2. At my work place we have DEV, QA and PROD environment. DEV is for developers only and QA for QA team only (no developers). Here are my questions. 1. In database.yml there is a comment for ''test:'' data source which states # Warning: The database defined as ''test'' will be erased and # re-generated from your development database when you run ''rake''. # Do not set this db to the same as development or production. I cannot afford to let this happen, since table creation and loading lots of data is under DBA''s control and not in my (developer) control. ---> Is there a way I can avoid erasing and regeneration of data? Can I set the test db to same as development without risking data loss? 2. Will I have to use set_table_name, set_primary_key in my test cases? 3. If I want to use fixtures how do I select a particular fixture from a list of fixtures in my test? TIA -daya --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 6 Sep 2006, at 20:33, linux user wrote:> I need lots of help in figuring out how to test legacy ActiveRecord > data models. > > Here are my constraints: > > 1. Almost all of my models have set_table_name, set_primary_key etc > and HABTM. > 2. At my work place we have DEV, QA and PROD environment. DEV is > for developers only and QA for QA team only (no developers). > > > Here are my questions. > > 1. In database.yml there is a comment for ''test:'' data source which > states > # Warning: The database defined as ''test'' will be erased and > # re-generated from your development database when you run ''rake''. > # Do not set this db to the same as development or production. > > I cannot afford to let this happen, since table creation and > loading lots of data is under DBA''s control and not in my > (developer) control. > ---> Is there a way I can avoid erasing and regeneration of data? > Can I set the test db to same as development without risking data > loss?Your QA database is not equivalent to a test database; you should see if you can create a new, possibly local db on developer machines to act as test. The QA database probably doesn''t need to be included; as you say, it isn''t for devs. The only way to set test the same as production is if you never run tests. The test database is for unit testing, and requires that you be able to set it to a default state between tests, hence the way it works. Paul --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 9/6/06, Paul Lynch <paul-UPn11tc4QPr10XsdtD+oqA@public.gmane.org> wrote:> > > On 6 Sep 2006, at 20:33, linux user wrote: > > > I need lots of help in figuring out how to test legacy ActiveRecord > > data models. > > > > Here are my constraints: > > > > 1. Almost all of my models have set_table_name, set_primary_key etc > > and HABTM. > > 2. At my work place we have DEV, QA and PROD environment. DEV is > > for developers only and QA for QA team only (no developers). > > > > > > Here are my questions. > > > > 1. In database.yml there is a comment for ''test:'' data source which > > states > > # Warning: The database defined as ''test'' will be erased and > > # re-generated from your development database when you run ''rake''. > > # Do not set this db to the same as development or production. > > > > I cannot afford to let this happen, since table creation and > > loading lots of data is under DBA''s control and not in my > > (developer) control. > > ---> Is there a way I can avoid erasing and regeneration of data? > > Can I set the test db to same as development without risking data > > loss? > > Your QA database is not equivalent to a test database; you should see > if you can create a new, possibly local db on developer machines to > act as test. The QA database probably doesn''t need to be included; > as you say, it isn''t for devs. > > The only way to set test the same as production is if you never run > tests. The test database is for unit testing, and requires that you > be able to set it to a default state between tests, hence the way it > works. > > PaulThanks Paul I was thinking on the similar lines but couldn''t express it completely in my head :) -daya> > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---