Summary (TL;DR)
with-redefs temporarily changes the root value of Vars during execution of body, restoring old values after. Changes are visible in all threads. Useful for mocking in tests. Example: (with-redefs [foo 2] foo) returns 2. Be careful with parallelism; concurrent use can permanently alter a Var. Does not work on macros or inlined functions. Redefs happen in parallel, so one redef cannot reference another's new value.
Public access expired
Save this link to your readplace queue to see the full content.
Save to My Queue