Today I used a feature of RSpec I've never used before,
cover returns true if it's argument is covered by the given range:
In my use case, I had an attribute
risk_score that is calculated by a third-party API. It should always be between zero and one, but it changes on every test run because the API considers the test user more and more risky each time.
cover allowed me to test this attribute, and the underlying logic, in a flexible way.