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.
Written by Chun-wei Kuo
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#