alexandernst alexandernst - 5 months ago 106
Ruby Question

Creating database & schema before rspec

I have a RoR 5 app which uses MySQL for testing and development. The MySQL server has a

database created, but the
database is missing (thus specs aren't running).

I could create the database on my own, but I'm wondering if there is a way I can make RoR create it for me when I run
rspec spec


I would do it like this:

RAILS_ENV=test bundle exec rake db:create 
RAILS_ENV=test bundle exec rake db:schema:load