-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the factories loading mechanism #3814
Fix the factories loading mechanism #3814
Conversation
050c4cf
to
747dec2
Compare
747dec2
to
bf938bd
Compare
The older way was working by accident and in direct contrast with FactoryBot's reloading mechanism. Now paths are correctly added to FactoryBot and the loading is delegated to the library (via reload).
FactoryBot is a development dependency but it's often used by apps and extensions by loading spree/testing_support/factories. We now let the users know which version of FactoryBot the factories provided by Solidus are guaranteed to work.
bf938bd
to
cc59f09
Compare
Some applications ended up requiring only some factories out of all the ones provided by Solidus. This is not well supported by FactoryBot. We instead suggest to load all factories and use the FactoryBot api to modify them to fit their needs.
cc59f09
to
5b08064
Compare
@elia this is still blocked by the things broken in the last version (as you pointed out in the PR's description), right? |
I'm just excluding the update of factory bot from this PR, which anyway is focused on doing things right with the current version. |
@elia We discussed IRL, it's a bugfix so it's ok to add it as patch level. |
Description
Requiring factories, although it was the correct way of doing it back in the day, has not been well supported by FactoryBot for a number of major versions1. Some applications were even relying on
require
to cherry pick only the factories they wanted.This PR fixes both of the problems with deprecations that clearly indicate the way forward
and updates the version of factory_bot_rails to the latest available. UPDATE: I'll leave the upgrade to a future PR as some stuff is broken on the latest version.Checklist:
1: The latest is 6, and it's already not the right way in 4, I didn't bother searching earlier versions