Knowledge Base: Custom database initialization

If your tests requires a database, Devver will create the database and then run the .devver/hooks/prepare_database hook. After running this hook, the test database should be ready to have tests run against it. Learn more about hooks.

The default action executed by the prepare_database hook is:

rake RAILS_ENV=test db:schema:load

For many Ruby on Rails-style projects, no further configuration will be needed.

Some projects, however, may need a customized database preparation step. You can do this by altering the prepare_database hook.

For example, the following command will use migrations to prepare the database:

rake RAILS_ENV=test db:migrate

Learn more about database configuration.