Transient attributes will not get passed to the model, but will be available in after-create hooks.
Trait helps you to remove duplication.
Attributes can be based on the values of other attributes.
Aliases allow to use named associations more easily.
FactoryBot Cheat Sheet by Ash Angell
FactoryBot is a fixtures replacement with a straightforward definition syntax, support for multiple build strategies (saved instances, unsaved instances, attribute hashes, and stubbed objects), and support for multiple factories for the same class (user, admin_user, and so on), including factory inheritance.
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets