Comparison
FakevsSpy
Fake
you write a working in-memory version of the repository, with real behaviour, just not one backed by a database.
A double with a real, working implementation that is unsuitable for production — an in-memory store, an embedded database, a local queue. It lets tests exercise genuine behaviour without the real dependency's cost. The risk is divergence: a fake that behaves differently from the real thing gives you green tests and a broken system.
Full entry →Spy
you wrap the real thing, let it do its actual job, and record the calls so you can check them afterwards.
A double that records how it was used for later assertion, often wrapping a real implementation. Unlike a mock it does not set expectations up front — you assert after the fact, which reads more naturally and couples less. It is the middle ground between a stub that asserts nothing and a mock that asserts everything.
Full entry →