各クラスのファクトリを作成する際には一つのシンプルなファクトリを作成する
各クラスに対してそのクラスのインスタンスを作成することに必要な単純な属性セットを供給する一つのファクトリを持つことを推奨します。ActiveRecord
オブジェクトを生成する際、バリデーションを通して必要とされる属性とデフォルトを持たない属性のみを提供することを意味します。継承によって作成された他のファクトリを作成し、各クラスに一般的なシナリオをカバーします
It is recommended that you have one factory for each class that provides the simplest set of attributes necessary to create an instance of that class. If you're creating ActiveRecord objects, that means that you should only provide attributes that are required through validations and that do not have defaults. Other factories can be created through inheritance to cover common scenarios for each class.
同じ名前で複数のファクトリを定義を試みることはエラーを起こすだろう。
Attempting to define multiple factories with the same name will raise an error.
(ブロックなしの)静的な属性はfactory_bot 5
で利用不可になりました。このブログの投稿(リンク)で属性の削除の決定に関してご覧ください。
Static attributes (without a block) are no longer available in factory_bot 5. You can read more about the decision to remove them in this blog post.