-
-
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
Move solidus admin promotion to legacy promotions #5724
Move solidus admin promotion to legacy promotions #5724
Conversation
068e8ce
to
d147ed0
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5724 +/- ##
=======================================
Coverage 88.84% 88.84%
=======================================
Files 704 704
Lines 16757 16761 +4
=======================================
+ Hits 14887 14891 +4
Misses 1870 1870 ☔ View full report in Codecov by Sentry. |
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.
We intensively paired on this
dc106b3
to
92e00c4
Compare
Hey @mamhoff can you please check the failing specs? I think it's something related. Thanks! |
f042cb6
to
bb974ae
Compare
For now, this introduces a hard dependency from legacy_promotions to the new admin.
We need a way of a spec telling the app to use the new admin for tests that require it, and using the old admin to not use it. After experimenting with using a cookie, which led to a number of undesirable issues (needing a new gem to manage cookies across Capybara drivers, having to visit some URL before being able to even set the cookie etc), what we do is we just define a global module attribute accessor on the dummy app that enables or disables the routes for the `solidus_admin` gem.
bb974ae
to
3bffe16
Compare
This drops the dependency between solidus_legacy_promotions and solidus_admin. If `solidus_legacy_promotions` is not defined, the admin will not have a promotion configuration. If `solidus_admin` is not defined, the routes and controllers necessary for the new admin won't be loaded.
This naming is better since two directories, `admin` and `solidus_admin` are really confusing, and naming them after the gems they use is more appropriate.
3bffe16
to
bce5114
Compare
Summary
We don't want any of the core gems to depend on
solidus_legacy_promotions
. This PR removes the dependency fromsolidus_admin
tosolidus_legacy_promotions
.This was pretty hard to do, because there's not a lot of support for differentiating between the two types of admin from an RSpec perspective. What we ended up doing was define a global switch for the DummyApp. If anyone is aware of something like
RSpec.current_test.metadata
, that would be even nicer, but I have not found it.This is also probably the first gem that makes use of the new admin, so it's a good discussion point for how we provide testing facilities for gems consuming the new admin.
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The first commit is not green, nor will it be. But the changes from the second commit tell what's wrong, so I'm opting to leave these separate for now.
The following are not always needed: