1

I inherited a Rails project where the (SQLite) Dev and Test databases are the same, as in the database.yml file.

Are there any advantages to this? Why would anyone do this?

2 Answers 2

2

The test database will get overwritten by the tests normally (unless you use transactional fixtures). If test and development databases are the same, your data will be erased every time you run your test suite. Development data may interfere with the test suite and make it unrealiable.

I would cleary consider this a design mistake. There is no reason, you should ever do this. Even the database.yml in a freshly created rails app 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.
Sign up to request clarification or add additional context in comments.

Comments

1

There are no advantages to this. There are disdvantages. test and development or production databases are supposed to be different. A lot of people leave test and development settings the same and it's not that big of a problem since the most important one is the production database. That's the reason i can think of that made the previous dev. on the project do that. It should not be like that though.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.