Fix the factories loading mechanism#3814
Merged
kennyadsl merged 4 commits intosolidusio:masterfrom Jan 8, 2021
Merged
Conversation
houndci-bot
reviewed
Oct 29, 2020
050c4cf to
747dec2
Compare
houndci-bot
reviewed
Nov 6, 2020
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
Member
|
@elia this is still blocked by the things broken in the last version (as you pointed out in the PR's description), right? |
Member
Author
I'm just excluding the update of factory bot from this PR, which anyway is focused on doing things right with the current version. |
jarednorman
approved these changes
Jan 3, 2021
aldesantis
approved these changes
Jan 4, 2021
Member
|
@elia We discussed IRL, it's a bugfix so it's ok to add it as patch level. |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
requireto 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