What does rake db:test:prepare actually do?

The rake db:migrate above runs any pending migrations on the
development environment and updates db/schema.rb. The rake
db:test:load recreates the test database from the current
db/schema.rb. On subsequent attempts, it is a good idea to first run
db:test:prepare, as it first checks for pending migrations and warns
you appropriately.

http://guides.rubyonrails.org/testing.html

Basically it handles cloning the database so you don’t have to run the migrations against test to update the test database.

Leave a Comment