Closed djfpaagman closed 10 months ago
Great solution!
The tests are failing. I think maybe due to your refresh mechanism not working as intended?
I had some troubles running the tests locally (fixed that now) and indeed this does not seem to work without side effects. I'll have another look at it at a later point!
I think I found a different solution, tests are constantly green for me now!
At least it's green! I think it'd be better to move all this from the general with_config
to the specific test? It is only really relevant to these two examples.
Yeah that could work as well 👍 but I think there will always be the possibility that a future test needs to override parent_mailer
as well and then you'll run into the same issue again. So I think keeping the reloading behavior in the test helper for overriding configs makes most sense to me.
But happy to move it to the test itself as well, let me know.
Let's move it now and move it back when it becomes necessary. Thanks!
@mikker: I've moved some things around with comments so that it's clear what's going on.
@mikker is there anything I can do to get this merged in? would love to see it released :)
Sorry, no, it's good. Thank you!
This is a bit related to #187, with the same behavior where we set the hostname dynamically based on locale.
With the introduction of the context in 1.1.0 (I think?) (PR: #180). the url helpers are no longer using the
default_url_options
from the mailer (either viaconfig.action_mailer.default_url_options
or when overriding them in a mailer themselves via adefault_url_options
method).This PR fixes that by passing them as arguments to the
url_for
method from the context.This probably also means you no longer necessarily need to to set a default host for the routes as well, as mentioned here in the docs:
https://github.com/mikker/passwordless/blob/cd0e0ed7cdba745dcae92e84d800122b8d3368b6/README.md?plain=1#L148-L155
I also added a reload when using
WithConfig
, as the parent class for the mailer is set from the config and that can change based on usage of the helper. This probably also needs to be included in #187.Let me know what you think!