factory-girl
factory-girl copied to clipboard
inherit buildOptions in extended factories
Probably the solution to: https://github.com/simonexmachina/factory-girl/issues/134
- Given a
parentFactory
defined withbuildOptions
with its respective callbacks. - Given a
childFactory
that extends thatparentFactory
. - 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.