Skip to main content

with-redefs

macrov1.3

clojure.core/with-redefs

Available in:BBCLJCLJS
(with-redefs [bindings & body])
binding => var-symbol temp-value-expr Temporarily redefines Vars while executing the body. The temp-value-exprs will be evaluated and each resulting value will replace in parallel the root value of its Var. After the body is executed, the root values of all the Vars will be set back to their old values. These temporary changes will be visible in all threads. Useful for mocking out functions during testing.

No examples yet. Be the first to add one!