RSpec shared_examples to verify mocks

I just finished reading POODR by Sandi Metz again, and I took more interest in the part of Chapter 9 where she talks about writing shared examples in order to verify an interface, and verifying that mocks and doubles haven’t gone stale.

The examples used were in MiniTest, which was basically a shared module across the classes (including the doubles) that implemented the shared interface.

Does anyone know of any good resources/recommendations about exploring this using RSpec’s shared_examples syntax? Has anyone done this? I’d like to know more.

1 Like