Last Updated: February 25, 2016
·
5.418K
· domon

Load Rails seed data into test database

For some apps to work properly, we have to load seed data into them.

Actually, there is a useful method Rails::Engine#load_seed which loads Rails engines' seeds.

In our test helper (e.g. spec/spec_helper.rb), we can call it like this:

Rails.application.load_seed

Then the seed data will be available in our tests.