Fork me on GitHub
#testing
<
2021-02-22
>
Noah Bogart20:02:17

is there any easy way to do "beforeEach" blocks for tests?

Noah Bogart20:02:55

I'd love to not have to do all of my set-up over and over again for a given batch of tests

Noah Bogart20:02:40

those are per-file, and i was hoping for per deftest block

Noah Bogart20:02:01

even the :each applies to every single deftest in a given file

Noah Bogart20:02:37

maybe i'll write up a macro to do this for me, lol

robertfw20:02:50

macros, the duct tape of Clojure

robertfw20:02:10

the last project I had which had some complex fixture setup tasks we ended up just writing a few helpers functions that we used in the test code that needed it. it felt a bit wrong coming from other environments that really emphasize separating fixtures and tests, but it worked fine

Noah Bogart20:02:58

yeah, seems like the best method. thanks