Nested factories in Factory Bot: what they are and how to use them - Code with Jason
14-Jan-2021 1291
Let’s use the following as an example. Let’s say that in the majority of your application’s tests that involve a User, you want just a regular old user. Maybe you have 30 such tests.But for a handful of tests you want to use a special kind of user, a user that indicates that the person using the application is a physician.In this scenario, the technical difference between a “physician user” and a regular user is that a physician user has a role attribute that’s set to 'physician'. Let’s say there are 6 tests that use a physician user.
Nested factories in Factory Bot: what they are and how to use them - Code with Jason #ruby #rubydeveloper #rubyonrails #Nested #factories #Factory #Jason #code https://rubyonrails.ba/link/nested-factories-in-factory-bot-what-they-are-and-how-to-use-them-code-with-jason