factory_bot
A library for setting up Ruby objects as test data
factory_bot 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. factory_bot provides a framework and DSL for defining and using factories - less error-prone, more explicit, and all-around easier to work with than fixtures. Each factory has a name and a set of attributes. The name is used to guess the class of the object by default. It is recommended that you have one factory for each class that provides the simplest set of attributes necessary to create an instance of that class. ...