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

Deprecate other code related to old factories loading #5059

Merged

Conversation

kennyadsl
Copy link
Member

@kennyadsl kennyadsl commented Apr 28, 2023

Summary

Ref #5023

People should have started to use require 'spree/testing_support/factory_bot'now, so this workaround is no longer needed.

Also, no one is calling the methods that check for the version of factory_bot, so we can safely deprecate that code.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@kennyadsl kennyadsl self-assigned this Apr 28, 2023
@kennyadsl kennyadsl requested a review from a team as a code owner April 28, 2023 08:02
@github-actions github-actions bot added the changelog:solidus_core Changes to the solidus_core gem label Apr 28, 2023
@kennyadsl kennyadsl force-pushed the kennyadsl/remove-factories-leftover branch 2 times, most recently from d9229af to 9d6e23d Compare April 28, 2023 09:32
@elia
Copy link
Member

elia commented Apr 28, 2023

@kennyadsl would make sense to add a warning in the file instructing people to stop requiring it?

@kennyadsl
Copy link
Member Author

@elia I tried but I think it's still loaded by Zeitwerk when someone require an inner module like 'Spree::TestingSupport::FactoryBot'. Do you know any way to avoid this?

@waiting-for-dev
Copy link
Contributor

@elia I tried but I think it's still loaded by Zeitwerk when someone require an inner module like 'Spree::TestingSupport::FactoryBot'. Do you know any way to avoid this?

Are you sure? I tried adding a puts line in spree/testing_support.rb, and I required the spree/testing_support/factory_bot in a sandbox application with the factory_bot_rails gem added. I didn't see the puts output.

However, shouldn't we deprecate the method itself?

@kennyadsl
Copy link
Member Author

Are you sure?

Nope, my attempt was removing the file completely and the CI was failing, but maybe thinking twice, it was for another reason, see here. Let me try again.

However, shouldn't we deprecate the method itself?

Yes, you are right, even if it's not used.

Considering that it's better to add deprecations to push people to not require this file at all, marking it and its content for removal, does this mean we can do this whole PR later after releasing v4.0? I think it does, no rush on this cleanup.

@waiting-for-dev
Copy link
Contributor

Considering that it's better to add deprecations to push people to not require this file at all, marking it and its content for removal, does this mean we can do this whole PR later after releasing v4.0? I think it does, no rush on this cleanup.

We can also release another 3.4.x version with the warning and remove the file altogether on v4, but either way it's not something critical

People should have started to require testing_support/factory_bot
now, so this workaround is no longer needed.

Also no one is calling the methods that check for the version
of factory_bot, so we can safely deprecate that code.
@kennyadsl kennyadsl force-pushed the kennyadsl/remove-factories-leftover branch from 9d6e23d to bf5b7aa Compare April 28, 2023 14:29
@kennyadsl kennyadsl added the backport-v3.4 Backport this pull-request to v3.4 label Apr 28, 2023
@kennyadsl
Copy link
Member Author

@waiting-for-dev This PR is now deprecating those methods/files instead of removing them. I think the idea to backport and release a patch is acceptable because we still didn't release v4.0.

@kennyadsl kennyadsl changed the title Remove leftovers from the legacy factories importing method Deprecate other code related to old factories loading Apr 28, 2023
Copy link
Contributor

@waiting-for-dev waiting-for-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kennyadsl kennyadsl merged commit daf1b10 into solidusio:master Apr 28, 2023
@kennyadsl kennyadsl deleted the kennyadsl/remove-factories-leftover branch April 28, 2023 15:56
@github-actions
Copy link

💔 All backports failed

Status Branch Result
v3.4 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

backport --pr 5059

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v3.4 Backport this pull-request to v3.4 changelog:solidus_core Changes to the solidus_core gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants