$ npm install barrels
or add the module to your package.json
and run
$ npm install
Drop your fixtures in test/fixtures
as JSON files named after your models.
Once your Sails.js server is started:
var barrels = require('barrels');
var fixtures = barrels.load().objects;
barrels.populate(function(err) {
...
});
After load
the fixture data will be accessible via the objects
property.
Populate
'ing the test database involves two steps:
- Removing any existing data from the collection corresponding to the fixture
- Loading the fixture data into the test database
Copyright (c) 2013 Ruslan Bredikhin