Fork me on GitHub
#testing
<
2019-02-07
>
ljosa20:02:04

I’m using clojure.test on a project now after using Midje for a long time. And I miss provided greatly (https://github.com/marick/Midje/wiki/Describing-one-checkable's-prerequisites). If you use clojure.test, what do you use with it to test that the function under test calls another function with certain arguments?

seancorfield21:02:48

@ljosa I'd be somewhat inclined to consider that a smell in unit testing, to be honest.

seancorfield21:02:49

But, if you must, you can use with-redefs to provide a redefinition of the function that saves its arguments to a local atom or something similar...

ljosa21:02:34

Yes, I’ve done that a little, but it’s extremely clunky.

seancorfield21:02:53

Which is nature's way of saying "Perhaps you shouldn't be doing this?" 🙂

ljosa21:02:20

Would it make you feel better if we called it integration testing? 😉

seancorfield21:02:12

Not much, no 🙂 I use Expectations and it has a side-effects function which does this and I think I've used it just once. Maybe twice. In 22,000 lines of Clojure test code at work.