RSpec Examples are, well, Examples
November 09, 2022
RSpec’s internal DSL allows creating some difficult-to-sustain structures and code, but there is one guiding principle that has helped me avoid making tests that are too weird:
RSpec tests should be examples of how the code under test would be used.
Let’s see a few examples: using subject
and avoiding predicate matchers.