Last active
November 7, 2025 10:32
-
-
Save wmnnd/cb80d4eae79d5d35b8229d6eec188ee5 to your computer and use it in GitHub Desktop.
Capture Token in Phoenx test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test "verify something from a token", %{conn: conn} do | |
| {:ok, agent_pid} = Agent.start_link(fn -> nil end) | |
| capture_token = fn token -> | |
| Agent.update(agent_pid, fn _ -> token end) | |
| end | |
| MyApp.SomeContext.send_verification_email(&capture_token.(&1)) | |
| token = Agent.get(token_agent, & &1) | |
| assert something(token) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment