thoughtbot / factory_bot

A library for setting up Ruby objects as test data.
https://thoughtbot.com
MIT License
7.89k stars 2.6k forks source link

Pass context to initialize_with #1648

Open mike-burns opened 2 months ago

mike-burns commented 2 months ago

This might be a duplicate of #1639.

Giving the context to initialize_with would give access to the transient attributes when building the object. This way we can make decisions while building the object.

We'll need to make sure we don't break existing, clever code in the process, e.g.

initialize_with { _1 }