-
-
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
Readd config.cache_classes
on test env and remove with_model
dep
#4358
Readd config.cache_classes
on test env and remove with_model
dep
#4358
Conversation
6d28a61
to
c05ac60
Compare
Rails' config setting `cache_classes` was recently set to `false` in the dummy app (see ef9b5ab). That was due to a misunderstanding, as Rails recommends it be true except when `spring` is present. From https://guides.rubyonrails.org/configuring.html#config-cache-classes: > Controls whether or not application classes and modules should be > reloaded if they change. When the cache is enabled (true), reloading > will not occur. Defaults to false in the development environment, and > true in production. In the test environment, the default is false if > Spring is installed, true otherwise. That wasn't such a big deal until now. However, if we try to use the new Ruby 3.1 in conjunction with `cache_classes` in the test environment, many errors related to STI classes not being found pop out. However, having the correct `false` value on Rails 7 raises an error sourced on the `with_model` gem. See Casecommons/with_model#35. Because of that, we remove the `with_model` dependency so that our path to support Ruby 3.1 is unblocked. We take different decisions to remove the occurrences of `with_model` usage on Solidus: - Tests on `Spree::Api::ResourceController`. That controller was only used on `Spree::Api::UsersController`. Therefore, it was no longer a valid abstraction: - We removed the tests altogether. - We moved the missing pieces to `UsersController`. - We removed the soft deletable specific test and added one to `UsersController`. - We marked `ResourceController` as deprecated (not removing it just in case some store uses it). - Tests on `Spree::Admin::ResourceController`, `Spree::CalculatedAdjustements`, `Spree::Validations::DbMaximumLengthValidtor` & `Spree::WalletPaymentSource`: we use a custom logic for the same behavior provided by `with_model`. - Tests on `Spree::SoftDeletable`: we use `Spree::Product` as a fixture.
c05ac60
to
c268949
Compare
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.
I like having a dependency less, and those Widget tests were always confusing to me.
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.
I'm vaguely apprehensive that extensions or stores might be using this, but it's a pretty easy change for them to switch off. Seems good.
Spree::Api::ResourceController is deprecated. Please, copy any logic you | ||
need and inherit directly from Spree::Api::BaseController. |
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.
"I didn't even know there was a Spree::Api::ResourceController
."–@benjaminwil
There's a typo in the commit message/PR name: "Readd" |
c42ae73
to
c268949
Compare
@jarednorman, hmm... I used readd as in re+add, i.e., add again 🙂 Does it sound too weird? Not an English native speaker, so I'll trust your judgment more than mine one thousand times 😉 |
Going ahead with the merge to not unblock support for Ruby 2.7 🙂 |
Please, inherit from Spree::Api::BaseController directly. Ref solidusio#4358
Please, inherit from Spree::Api::BaseController directly. Ref solidusio#4358
Please, inherit from Spree::Api::BaseController directly. Ref solidusio#4358
Please, inherit from Spree::Api::BaseController directly. Ref solidusio#4358
Please, inherit from Spree::Api::BaseController directly. Ref solidusio#4358
Please, inherit from Spree::Api::BaseController directly. Ref #4358
Rails' config setting
cache_classes
was recently set tofalse
in thedummy app (see
ef9b5ab).
That was due to a misunderstanding, as Rails recommends it be true
except when
spring
is present. Fromhttps://guides.rubyonrails.org/configuring.html#config-cache-classes:
That wasn't such a big deal until now. However, if we try to use the new
Ruby 3.1 in conjunction with
cache_classes
in the test environment,many errors related to STI classes not being found pop out.
However, having the correct
false
value on Rails 7 raises an errorsourced on the
with_model
gem. SeeCasecommons/with_model#35.
Because of that, we remove the
with_model
dependency so that our pathto support Ruby 3.1 is unblocked. We take different decisions to remove
the occurrences of
with_model
usage on Solidus:Tests on
Spree::Api::ResourceController
. That controller was onlyused on
Spree::Api::UsersController
. Therefore, it was no longer avalid abstraction:
UsersController
.UsersController
.ResourceController
as deprecated (not removing it just in case some store uses it).Tests on
Spree::Admin::ResourceController
,Spree::CalculatedAdjustements
,Spree::Validations::DbMaximumLengthValidtor
&Spree::WalletPaymentSource
: we use a custom logic for the samebehavior provided by
with_model
.Tests on
Spree::SoftDeletable
: we useSpree::Product
as a fixture.