thoughtbot / thoughtbot/factory_bot
attributes_for does not use initialize_with like the docs states it does
Open
@mike-burns is already working on this.
Since Dec 27, 2023.
bug
- Dominant language
- Ruby
- Stars
- 8.2k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
According to the docs, attributes_for constructs a hash using initialize_with, but this isn't actually the case.
Is this a bug, or incorrect documentation?
Reproduction Steps
Reproduction script: https://gist.github.com/ezekg/7738249c671e48c0372884c847e2559f
Expected behavior
The initialize_with callback is used during creation of the attributes_for hash.
Actual behavior
The initialize_with callback is not used for the attributes_for hash.
System configuration
factory_bot version: v6.4.2
rails version: v7.1.2
ruby version: v3.2.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.