Skip to content

Instantly share code, notes, and snippets.

@keithpitt
Created September 2, 2010 12:25
Show Gist options
  • Save keithpitt/562218 to your computer and use it in GitHub Desktop.
Save keithpitt/562218 to your computer and use it in GitHub Desktop.
global.TestHelper = {
loadFixtures: function(db) {
var file = fs.readFileSync("fixtures.yml").toString();
var fixtures = yaml.eval(file);
for(var table in fixtures) {
db.collection(table, function(err, collection) {
collection.remove();
collection.insert(fixtures[table], function(err, docs) {
docs.forEach(function(doc) {
// Do nothing.
});
});
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment