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

Access current_time_adapter in runtime instead of compile time #252

Merged
merged 1 commit into from Nov 9, 2019

Conversation

didia
Copy link
Contributor

@didia didia commented Oct 11, 2019

This fixes issue #236

I tried using Mox to inject a Joken.CurrentTime.Mock instance but it did not work because the way Joken was accessing the adapter using module attributes which are resolved at compile time instead of runtime.

By using a private function to access the adapter, we make sure that the adapter is resolved at runtime.

This fixes issue joken-elixir#236
I tried using Mox to inject a Joken.CurrentTime.Mock instance but because the way Joken was accessing the adapter using module attributes which are resolved at compile time instead of runtime. And because the Joken module is already compiled when we pull it as a dependency, the adapter was always using the `Joken.CurrentTime.OS` in test.

By using a private function to access the adapter, we make sure that the adapter is resolved at runtime.
@victorolinasc victorolinasc merged commit f6487ed into joken-elixir:master Nov 9, 2019
@victorolinasc
Copy link
Collaborator

Thanks! Much appreciated!

Sorry for the long wait...

Did not know this would be such a wanted feature... sorry for my hindsight!

@didia didia deleted the patch-1 branch December 28, 2019 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants