In recent changes there is a shared smell amongst the team that we have not been consistent with how we are using factories.
In some cases we have defined traits, in other places we are using a base trait and then specifying the additional properties we want set either within the factory or in the unit tests themselves.
So we need to complete a review of our factories and ensure we are doing these things
Following Thoughtbots own guidance on factories
It is highly 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.
Consistent in our use of factories. We should be referring to factories with specific traits that describe the instance we want to create, rather than specifying the properties we want set
Avoiding mixing build and create statements. Where we request an object to be built, we should reasonably expect that the database is not hit, but in fact it often is. We should try to resolve this mixing of initialization types
Since this issue was raised our agreement on how we use factories has evolved. The work still needs to be done but when we come to this tests should be reviewed beforehand.
In recent changes there is a shared smell amongst the team that we have not been consistent with how we are using factories.
In some cases we have defined traits, in other places we are using a base trait and then specifying the additional properties we want set either within the factory or in the unit tests themselves.
So we need to complete a review of our factories and ensure we are doing these things