Impersonator: record and replay object interactions
Impersonator is a Ruby library to record and replay object interactions. Familiar with VCR? Impersonator is like VCR but for ruby objects instead of HTTP.
When testing, you often find services that are expensive to invoke, and you need to use a double instead. Creating stubs and mocks for simple scenarios is easy, but, for complex interactions, things get messy fast. Stubbing elaborated canned response and orchestrating multiple expectations quickly degenerates in brittle tests that are hard to write and maintain.
Impersonator comes to the rescue.