-
-
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
[legacy_promotions]: Correct decorator naming #5946
base: main
Are you sure you want to change the base?
Conversation
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.
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. 🚨 Try these New Features:
|
c6f6c47
to
fe18ce3
Compare
@@ -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 } |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
fe18ce3
to
e639857
Compare
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: