Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make WorkPackage factory use default factory for type if one is defined
With TestProf, it's possible to define a default factory for a given factory using `FactoryBot.set_factory_default`. It activates if a factory is set for a given field, for instance `author factory: :user`. For work packages, there is no such factory defined for `type` field because we have a `after_build` hook to use the first project's type. Nevertheless, when a default factory has been set, we want to use it instead, especially as getting the first type is not deterministic when there are multiple types defined. This commit makes the WorkPackage factory use this factory default for the `type` field if one is defined. This fixes flaky test `spec/services/relations/delete_service_spec.rb` where the wrong type would be used instead of the intended one. I also updated the position of the type with mandatory custom field to be after the type task so that it would work even without the default factory.
- Loading branch information