I'm testing a function that uses two other functions from other namespace.
(fact "a test"
(let [result (function-that-uses-functions-from-other-namespace)]
result => truthy))
I want to stub out the functions from other namespace and I'm having problems writing the test.
(fact "a test"
(let [result (function-that-uses-functions-from-other-namespace)]
(function-that-uses-functions-from-other-namespace)
(provided (other-namespace/function1 "parameter") => "stub_response"))
but this approach don't seem to work. Any hints? Is it simply the case of let being evaluated before checkables as suggested in Using midje provided in a let clause doesn't stub methods
resultanywhere in the second example and you seem to invoke the the same function twice. So it's not clear to me what your second code snippet is trying to achieve. In general, this structure cannot work and yes you're exactly right, the problem is covered by the question you link to. - joelittlejohn