This package has been deprecated

Author message:

Bookshelf support is now included in the factory-girl package

factory-girl-bookshelf

1.0.3 • Public • Published

factory-girl-bookshelf

Build Status

A Bookshelf adapter for factory-girl.

Usage

require('factory-girl-bookshelf')();

Or, if you want to specify which models it should be used for:

require('factory-girl-bookshelf')(['User', 'Foo', 'Bar']);

Relationships can be created using assoc:

var Model = Bookshelf.db.Model;
var Parent = Model.extend({
  children: function() {
    return this.hasMany(Child, 'parent_id');
  }
});
var Child = Model.extend({
  parent: function() {
    return this.belongsTo(Parent, 'parent_id');
  }
});
factory.define('parent', Parent);
factory.define('child', Child, {
  parent_id: factory.assoc('parent', 'id')
});

Package Sidebar

Install

npm i factory-girl-bookshelf

Weekly Downloads

680

Version

1.0.3

License

MIT

Last publish

Collaborators

  • aexmachina