1.0.3 • Published 8 years ago

factory-girl-bookshelf v1.0.3

Weekly downloads
19
License
MIT
Repository
github
Last release
8 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

8 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.0

10 years ago