FactoryBot: How to get the class from a factory name

Posted About 9 years ago. Visible to the public.

When you want to look up a class for a given factory, do it like this:

>> FactoryBot.factories.find('admin').build_class
=> User

In older versions, you could do:

>> FactoryBot.factory_by_name('admin').build_class
=> User
Arne Hartherz
Last edit
Almost 4 years ago
Dominik Schöler
Keywords
FactoryGirl
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2015-03-12 09:38)