Skip to content

Conversation

alexisruccius
Copy link
Contributor

When testing a process that calls a mock inside its init/1, I ran into an Mox.UnexpectedCallError because the process wasn’t yet started when defining Mox.allow/3.

The fix was to use a deferred function with Mox.allow/3, so that Mox resolves the process later when the mock is actually invoked.

This change updates the docs to clarify that deferred functions can be used in such cases.

@josevalim josevalim merged commit 89e22d7 into dashbitco:main Aug 27, 2025
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

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.

2 participants