Skip to content

Instantly share code, notes, and snippets.

@bkeepers
Created April 15, 2011 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bkeepers/921789 to your computer and use it in GitHub Desktop.
Save bkeepers/921789 to your computer and use it in GitHub Desktop.
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