Factories
Learn about the uses of factories and how to install factories.
We'll cover the following...
Factories
Generically, the factory pattern refers to a class or module in the application whose sole purpose is to safely and correctly create other objects in the application. Outside of tests, factories are frequently used to encapsulate complex object-creation logic. Inside of Rails tests, factories are used to provide templates for creating valid objects.
Uses of factories
Rather than specifying all the test data exactly, the factory tool provides a blueprint ...