Fork me on GitHub

@ljosa check out my lib for test doubles. There's also a [outdated] list of alternative libs at the bottom of the readme. Whether mocks should be used or not depends on the style of testing. Personally I prefer writing many unit tests with mocked-out dependencies and minimize writing integration tests. There's a nice overview of different approaches at


I'd also recommend to extract all the dependencies you want to stub as explicit arguments instead of using with-redefs-like helpers. It's easier to maintain in the long run (because it becomes apparent from the API declarations what can/should be stubbed) and is more thread-safe (patching doesn't play well with core.async, concurrent test running, etc.).