Skip to content
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

Merged
merged 4 commits into from
Jan 8, 2021

Conversation

elia
Copy link
Member

@elia elia commented Oct 29, 2020

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:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

1: The latest is 6, and it's already not the right way in 4, I didn't bother searching earlier versions

@elia elia force-pushed the elia/update-factory-bot-rails branch from 050c4cf to 747dec2 Compare November 6, 2020 12:59
@elia elia force-pushed the elia/update-factory-bot-rails branch from 747dec2 to bf938bd Compare November 13, 2020 12:01
@elia elia changed the title Update factory bot rails Update FactoryBot and fix the factories loading mechanism Nov 13, 2020
elia added 3 commits November 13, 2020 13:22
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.
@elia elia force-pushed the elia/update-factory-bot-rails branch from bf938bd to cc59f09 Compare November 13, 2020 12:22
@elia elia marked this pull request as ready for review November 13, 2020 13:46
@elia elia changed the title Update FactoryBot and fix the factories loading mechanism Fix the factories loading mechanism Nov 13, 2020
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.
@elia elia force-pushed the elia/update-factory-bot-rails branch from cc59f09 to 5b08064 Compare November 13, 2020 17:16
@kennyadsl
Copy link
Member

@elia this is still blocked by the things broken in the last version (as you pointed out in the PR's description), right?

@elia
Copy link
Member Author

elia commented Dec 20, 2020

@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.
Once this is merged I can give another try at upgrading it. 👍

@kennyadsl
Copy link
Member

kennyadsl commented Jan 8, 2021

@elia can we merge/release this in 3.1 or there's a specific reason to backport this change in 2.11 and 3.0 as well?

We discussed IRL, it's a bugfix so it's ok to add it as patch level.

@kennyadsl kennyadsl added this to the 2.11 milestone Jan 8, 2021
@kennyadsl kennyadsl merged commit 9801649 into solidusio:master Jan 8, 2021
@kennyadsl kennyadsl deleted the elia/update-factory-bot-rails branch January 8, 2021 13:35
@kennyadsl kennyadsl added changelog:solidus_core Changes to the solidus_core gem and removed Needs Backport labels Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_core Changes to the solidus_core gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants