Someone asked this question here:
How to load db:seed data into test database automatically?
But their solution only works if you are going to run db:test:prepare which depends on a schema to load. Mongoid doesn’t have a schema file, and db:test:prepare doesn’t do anything and so this is not working. Is there another strategy that would work?
Just as a FYI, I figured out a way to meet my requirements. I set up a database called seed like so in mongoid.yml:
Then in my model I just have the datase use seeds like:
This actually works great because production, test, and development are all pulling from the seed database, which is what I want. And I’m never vacuuming out the data when running tests.