3 ms·
Clojure does something very much like this using the with-redefs [0] form. If you have a function like: (defn send-mail [receiver-ids title text] ..
by divs1210 5y ago
Clojure does something very much like this using the with-redefs [0] form.
If you have a function like:
(defn send-mail [receiver-ids title text]
...)
You can mock it out in your tests like:
(with-redefs [send-mail (fn [r-ids title text]
(println r-ids title text))]
;; send-mail will just print
...)
[0] https://clojuredocs.org/clojure.core/with-redefs https://clojuredocs.org/clojure.core/with-redefs