Manually generate a Factory for a Model after created
If you ever need to create a factory for an existing model, all you have to do is run the generator.
So if you had an existing
Article model, and it had attributes such as
user:references, you would run…
bin/rails g factory_bot:model Article title:string content:text user:references
and it will generate a factory for you ready to use in your tests.