rubocop / rubocop-factory_bot

Code style checking for factory_bot files.
https://docs.rubocop.org/rubocop-factory_bot
MIT License
44 stars 13 forks source link

create the rubocop that will check name of factory bot #57

Open Ivanov-Anton opened 1 year ago

Ivanov-Anton commented 1 year ago

Description:

In case when developer defines a factory in a separate file (one file equal to one factory) the file name of such a factory should be one of these:

  1. Pluralize the model name (example: country model => countries.rb)
  2. model name and plus "_factory" (example: country model => country_factory.rb)

Additionally, the new robocop can be implemented with configuration options to decide what style from these two is chosen.

Ivanov-Anton commented 1 year ago

see how the annotate_models gem is detect factories

(spec|test)/factories/<model>_factory.rb