clojure-spec

About: http://clojure.org/about/spec Guide: http://clojure.org/guides/spec API: https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html
arohner 2020-09-28T13:11:06.027800Z

When using stest/instrument in tests, how do you clean up after a test? e.g. ` (deftest foo (stest/instrument foo {:stub foo})

alexmiller 2020-09-28T13:11:48.028300Z

unstrument

arohner 2020-09-28T13:11:57.028500Z

right, but you don’t know what the previous state was

arohner 2020-09-28T13:12:08.028800Z

was it instrumented, or stub+ instrumented?

alexmiller 2020-09-28T13:13:17.029600Z

Sorry, not understanding the question

arohner 2020-09-28T13:14:50.031100Z

We have some code that is always instrumented. During a test, if I call (instrument foo {:stub foo}), that overwrites the existing instrument with a stub+instrument. Now if I call unstrument at the end, the next test will run with foo un instrumented

alexmiller 2020-09-28T13:16:30.031800Z

Instrument remembers the old var and unstrument replaces it iirc

borkdude 2020-09-28T21:11:35.032300Z

@arohner I have some code to deal with that: https://github.com/borkdude/respeced#with-instrumentation

👍 1