1.0.3 • Published 9 years ago

factory-girl-bookshelf v1.0.3

Weekly downloads
19
License
MIT
Repository
github
Last release
9 years ago

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')
});
1.0.3

9 years ago

1.0.2

11 years ago

1.0.1

11 years ago

1.0.0

11 years ago

0.1.6

11 years ago

0.1.5

11 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.0

11 years ago