Fork me on GitHub
#test-check
<
2019-05-27
>
Ho0man16:05:43

Hi, everyone I was wondering how can I use clojure.test/use-fixture with test-check’s defspec?

ossoso05:07:36

How would I emulate the use of fixtures for each trial? Macro/higher order function?

colinkahn00:07:39

Higher order function is what I've used before.

ossoso08:07:26

I ended up writing the following macro:

(defmacro db-fixture [& body]
  `(with-open [node# (db/start-node {})]
     (binding [*node* node#]
       ~@body)))

👍 1
gfredericks16:05:19

@ho0man is your issue that you want the fixture to run around each trial?

Ho0man16:05:05

Nope, the whole test

Ho0man16:05:18

But separately for different tests in a single namespace

gfredericks16:05:55

I think that should just work

Ho0man16:05:11

:)) Yeah It does Thanks @gfredericks (Sorry to bother you)

👍 4
ossoso05:07:36

How would I emulate the use of fixtures for each trial? Macro/higher order function?