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

[legacy_promotions]: Correct decorator naming #5946

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Nov 20, 2024

Summary

This changes the file names of decorators in the solidus_legacy_promotions gem to match Zeitwerk's expectations.
solidus_promotions is actually entirely fine.

This has been tested with solidusio/solidus_support#87, but is fully compatible with the classic way of loading each and every decorator on every app reload.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

If we want to use these decorators with Zeitwerk, their naming scheme
has to exchange module name and type. For example,

app/decorators/solidus_legacy_promotions/models/line_item_decorator.rb becomes
app/decorators/models/solidus/legacy_promotions/line_item_decorator.rb

This will eventually allow us to use Zeitwerk for loading decorators.
@mamhoff mamhoff requested a review from a team as a code owner November 20, 2024 15:59
@github-actions github-actions bot added the changelog:solidus_legacy_promotions Changes to the solidus_legacy_promotions gem label Nov 20, 2024
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.45%. Comparing base (104f813) to head (fe18ce3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5946      +/-   ##
==========================================
- Coverage   89.54%   89.45%   -0.09%     
==========================================
  Files         782      782              
  Lines       17997    17997              
==========================================
- Hits        16116    16100      -16     
- Misses       1881     1897      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@@ -6,6 +6,10 @@ module SolidusLegacyPromotions
class Engine < ::Rails::Engine
include SolidusSupport::EngineExtensions

initializer "solidus_legacy_promotions.patch_state_machine", after: "spree.load_config_initializers" do
config.to_prepare { SolidusLegacyPromotions::SpreeOrderStateMachineDecorator }
Copy link
Member

Choose a reason for hiding this comment

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

Would like to leave a comment here on why this is necessary

Copy link
Member

Choose a reason for hiding this comment

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

@mamhoff saw you added it as commit message. 👍🏻 for this, but I still like to have a code comment here.

Solidus Support's new Zeitwerk-based loading mechanism only works for
decorating autoloaded classes. The order state machine is in `lib`, and
thus is not autoloaded, so this decorator is not loaded either unless we explicitly
load it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_legacy_promotions Changes to the solidus_legacy_promotions gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants