-
-
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
Admin users did not work with custom user models #4238
Conversation
end | ||
|
||
before do | ||
Spree.user_class = 'UserModel' |
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 think we should do an after block here too to make sure subsequent tests are using the original User.
893a282
to
9370d04
Compare
Spree.user_class = 'UserModel' | ||
UserModel.create(email: "a@solidus.io") | ||
example.run | ||
Spree.user_class = 'Spree::LegacyUser' | ||
end |
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.
Can we take the old value of user_class
and reset it later instead of hardcoding the value that we are using now? I.e.:
Spree.user_class = 'UserModel' | |
UserModel.create(email: "a@solidus.io") | |
example.run | |
Spree.user_class = 'Spree::LegacyUser' | |
end | |
actual_user_class = Spree.user_class | |
Spree.user_class = 'UserModel' | |
UserModel.create(email: "a@solidus.io") | |
example.run | |
Spree.user_class = actual_user_class | |
end |
8b7c9d8
to
c74f46e
Compare
end | ||
|
||
around do |example| | ||
actual_user_class = Spree.user_class |
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.
Oh, my fault. This should fix the CI, right?
actual_user_class = Spree.user_class | |
actual_user_class = Spree.user_class.name |
c74f46e
to
705c7d1
Compare
If Spree.user_class was other than Spree::User, it was failing to create edit and delete url's in Admin::UsersController#index, using CustomUser for example, it tried to generate: admin_custom_user_url instead of using the existing admin_user_url
705c7d1
to
67eccb4
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.
Thanks!!
Description
If Spree.user_class was other than Spree::User, it was failing
to create edit and delete url's in Admin::UsersController#index,
using CustomUser for example, it tried to generate: admin_custom_user_url
instead of using the existing admin_user_url
Checklist: