Class: RSpec::Matchers::BuiltIn::ChangeDetails

  • Object
show all
Defined in:


Encapsulates the details of the before/after values.

Note that this class exposes the actual_after value, to allow the matchers above to derive failure messages, etc from the value on demand as needed, but it intentionally does not expose the actual_before value. Some usages of the change matcher mutate a specific object returned by the value proc, which means that failure message snippets, etc, which are derived from the before value may not be accurate if they are lazily computed as needed. We must pre-compute them before applying the change in the expect block. To ensure that all change matchers do that properly, we do not expose the actual_before value. Instead, matchers must pass a block to perform_change, which yields the actual_before value before applying the change.