I need lots of help in figuring out how to test legacy ActiveRecord data models.
Here are my constraints:
- Almost all of my models have set_table_name, set_primary_key etc and HABTM.
- 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.
- 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?
Will I have to use set_table_name, set_primary_key in my test cases?
If I want to use fixtures how do I select a particular fixture from a list of fixtures in my test?