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 #7

Merged
merged 1 commit into from
Sep 22, 2020
Merged

Conversation

sienic
Copy link
Contributor

@sienic sienic commented Sep 20, 2020

Probably the solution to: simonexmachina/factory-girl#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 aims to solve this.
(the linter run at the pre commit hook added some style changes).

@ratson ratson merged commit 59c1747 into ratson:master Sep 22, 2020
@ratson
Copy link
Owner

ratson commented Sep 22, 2020

@sienic Thank you for the PR, close #8

@sienic
Copy link
Contributor Author

sienic commented Sep 22, 2020

@ratson thank you for the release! 🙌

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.

2 participants