RSpec matchers are a powerful tool. They allow you describe what your intentions are in a concise and accurate way.

However, like anything meant to be interpreted by a machine, they can become verbose.

Imagine we have a Post class, which has a list of comments stored managed by some external service that we access over HTTPs.

We want to test that we call the API with the correct parameters. It’s a simple proposition, but the expectation can become a little unwieldy and repetitive.

Not terrible, but certainly a bit verbose and repetitive. We can do better.