Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Syntax for a JavasScript implementation of factory_girl
Factory.define('game', Game)
.sequence('id')
.attr('is_over', false)
.attr('created_at', "2011-02-01T22:36:45-06:00")
.sequence('random_seed')
.attr('players', function() {
return [
Factory.attributes('player'),
Factory.attributes('player')
];
});
Factory.attributes('game') // return just the attributes
Factory.build('game') // returns new Game(attributes);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment