FactoryBot: How to get the class from a factory name

Updated . Posted . 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
Profile picture of Arne Hartherz
Arne Hartherz
Last edit
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)