you are switching between them by using a different environment by stating the environment you want to use in environment.rb or by telling your application server to do so (for example the mongrel by mongrel_rails start -e production.
The environment is what is the ‘headline’ above the configurations. A database-config comes with three predefined environments ‘development’, ‘test’ and ‘production’ but you might configure some others for yourself.
The test environment is special because integration tests with fixtures which represent test data will be performed on a special test database. The advantage should be obvious. On the development database you should perform your development. This might be an physically different machine from your production database or at least decoupled as another database on the same machine. This way you could release stable versions to production and go online with it and destroy nothing on your production data while you are evolving on the development db.
Said shortly: As in many cases rails forces you to do the right thing.