Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for using adapters to provide support for different persistence layers #15

Open
wants to merge 316 commits into
base: master
Choose a base branch
from

Conversation

simonexmachina
Copy link

Also includes a default Adapter that provides backwards compatibility.

Here's an example adapter for sequelize:

var Factory = require('factory-lady'),
    Adapter = Factory.Adapter;

var SequelizeAdapter = function() {};
SequelizeAdapter.prototype = new Adapter();
SequelizeAdapter.prototype.create = function(Model, props) {
  return Model.build(props);
};
SequelizeAdapter.prototype.save = function(doc, Model, cb) {
  doc.save()
    .success(function() {
      cb();
    })
    .error(function(event) {
      var err = new Error('Failed to save fixture');
      err.event = event;
      cb(err);
    });
};

var adapter = new SequelizeAdapter();
Factory.setAdapter(adapter);

simonexmachina and others added 30 commits May 4, 2015 13:35
Add ability to provide default attributes for assoc
Add multi_assoc function
Fix typo in code sample
# By Melanie VanderLugt (1) and Yannick François (1)
# Via Simon Wade (2) and Melanie VanderLugt (1)
* 'master' of github.com:aexmachina/factory-girl:
  Replace merge with lodash
  Fix typo in code sample
simonexmachina and others added 30 commits April 28, 2017 10:48
Modify chancegenerator to support methods with multiple parameters
Fix adapter usage documentation
* 'master' of github.com:aexmachina/factory-girl:
  Fix adapter usage documentation
* master:
  Allow num to be omitted in createMany when used with an array of attrs
  Fix adapter usage documentation
* extend:
  Added support for extending factories
* 'master' of github.com:aexmachina/factory-girl:
  Add missing closing quote
…alizers

Allow extending function initializers
* 'master' of github.com:aexmachina/factory-girl:
  Adding deterministic dependencies (package-lock.json) and fixing versions of sinon and sinon-chai
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.