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

Move solidus admin promotion to legacy promotions #5724

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Apr 17, 2024

Summary

We don't want any of the core gems to depend on solidus_legacy_promotions. This PR removes the dependency from solidus_admin to solidus_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:

  • I have written a thorough PR description.
  • I have kept my commits small and atomic.
    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.
  • I have used clear, explanatory commit messages.

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.

@mamhoff mamhoff requested a review from a team as a code owner April 17, 2024 11:39
@github-actions github-actions bot added changelog:repository Changes to the repository not within any gem changelog:solidus_admin labels Apr 17, 2024
@mamhoff mamhoff force-pushed the move-solidus-admin-promotion-to-legacy-promotions branch from 068e8ce to d147ed0 Compare April 17, 2024 12:10
Copy link

codecov bot commented Apr 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.84%. Comparing base (7ba0f98) to head (bce5114).

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.
📢 Have feedback on the report? Share it here.

Copy link
Member

@tvdeyen tvdeyen left a 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

@mamhoff mamhoff force-pushed the move-solidus-admin-promotion-to-legacy-promotions branch from dc106b3 to 92e00c4 Compare April 17, 2024 19:41
@kennyadsl
Copy link
Member

Hey @mamhoff can you please check the failing specs? I think it's something related. Thanks!

@mamhoff mamhoff force-pushed the move-solidus-admin-promotion-to-legacy-promotions branch 3 times, most recently from f042cb6 to bb974ae Compare April 18, 2024 10:58
mamhoff added 3 commits April 18, 2024 14:07
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.
@mamhoff mamhoff force-pushed the move-solidus-admin-promotion-to-legacy-promotions branch from bb974ae to 3bffe16 Compare April 18, 2024 12:07
mamhoff added 2 commits April 18, 2024 14:46
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.
@mamhoff mamhoff force-pushed the move-solidus-admin-promotion-to-legacy-promotions branch from 3bffe16 to bce5114 Compare April 18, 2024 12:46
@kennyadsl kennyadsl merged commit 68b294f into solidusio:main Apr 18, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:repository Changes to the repository not within any gem changelog:solidus_admin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants