-
-
Notifications
You must be signed in to change notification settings - Fork 730
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
[Spree Upgrade][BackOffice] De-deface payment method new and adapt to spree 2 (1 broken test) #3121
Comments
only one broken spec currently:
|
So, after the de-deface in #3156 has been merged to 2-0-stable the payment methods page is working fine. The error is still the same and the problem is related to the mix of the paypalexpress method and the tag list attributes on payment_method. I tried to move/copy these acts_as_taggable and tag_list attributes: openfoodnetwork/app/models/spree/payment_method_decorator.rb Lines 7 to 11 in 832dca9
to a new Spree::PaymentMethod::Check.class_eval and also to a Spree::Gateway::PayPalExpress.class_eval, non worked... Needs further investigation. |
The remaining broken spec is:
|
Someone once had a similar problem, but their solution doesn't work for us: https://stackoverflow.com/questions/20045932/undefined-method-association-class-for-nilnilclass |
Other people having this issue: rails/rails#3847
|
The console output above is from within the test server ran by the feature spec. If I run these commands within the spec, there is more visible and
I also wanted to find out in which order the code is loaded. I placed a put statement in the paypal express code and one in our decorator. Running rails console or server in development env:
But when run in test env:
In both cases our override is ignored though:
|
I tried going back to activerecord 3.2.22.2, but that didn't change anything. Running out of ideas... |
Okay, adding |
Just to visualise the inheritance:
We do a class_eval on Gateway and PaymentMethod. PaymentMethod works, but Gateway and PayPalExpress don't know about it. The load sequence is this:
And we end up with:
So the core problem is that Gateway doesn't inherit PaymentMethod's ActiveRecord associations. We can probably ignore PayPalExpress for now. Our spec code for this issue can be simplified to this: expect(Spree::Gateway.new.tag_list).to eq [] |
great investigation @mkllnk Did you see the original issue? the is is on StripeConnect another child of Gateway #2781 And btw, this problem is also happening in:
|
I finally made some progress here and can make that part of the spec pass without changing original Spree code, just loading decorators at the right time. This has been so difficult, because we are dealing with two issues here:
|
well done. amazing work @mkllnk |
Due to a bug in ActiveRecord we need to load the tagging code in Gateway which should have inherited it from its parent PaymentMethod. We have to call it before loading the PaymentMethod decorator because the tagging code won't load twice within the inheritance chain. openfoodfoundation#3121
Due to a bug in ActiveRecord we need to load the tagging code in Gateway which should have inherited it from its parent PaymentMethod. We have to call it before loading the PaymentMethod decorator because the tagging code won't load twice within the inheritance chain. openfoodfoundation#3121
I just confirmed that "Main config menu is showing up on the right side" is fixed! 👍 |
Main config menu is showing up on the right side instead of the list of hubs that can be associated with the payment method.
payment_method_new is defaced. Needs to be de-defaced (in master first).
Errors in features/admin/payment_method_spec.rb:
The text was updated successfully, but these errors were encountered: