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

inherit buildOptions in extended factories #154

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sienic
Copy link

@sienic sienic commented Sep 19, 2020

Probably the solution to: #134

  • Given a parentFactory defined with buildOptions with its respective callbacks.
  • Given a childFactory that extends that parentFactory.
  • Whenever a models is built out of the aforementioned childFactory,
  • the callbacks defined in the parentFactory are not being called.
const parentFactory = FactoryGirl.define('parent', Model, initializer, buildOptions);
const childFactory = FactoryGirl.extend('parent', 'child');

// whenever we build a childFactory, i.e.
await FactoryGirl.build('child');
// the `afterBuild`, and `afterCreate` callbacks set in parentFactory are not being called

This PR tries to solve this.

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.

1 participant