We do this format for others changes so its certainly something to consider for
larger diffs, the project is https://github.com/rspec/rspec with the matchers
living within rspec-expectations and diffing tools in rspec-support.
Cheers
Jon
On Thu, 30 Oct 2025, at 10:11 AM, Augusts Bautra wrote:
> Hello,
>
> If a change assert fails we get a oneliner failure message like
>
> expected `object.data` to have changed to { "key" => "value" }, but is now {
> "something" => "else" }
>
> With a bulkier object (array of hashes, a large hash, it's common) the
> dividing part ", but is now" is hard to see.
>
> Let's improve the readability of failures like this!
>
> There are a number of ways to go about this, but one I've come up with is a
> three-line formatting - first describes the nature of the change failure (did
> not change/ changed to wrong value etc.), second shows expectation, and third
> shows the gotten value, aligned to the second row for easier diff, like so:
>
> expected `object.data` to have changed, but the new value did not match
> expectation:
> expected: { "key" => "value" }
> was: { "something" => "else" }
>
> Is this something worth opening a PR for? Which github project should I look
> at?
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "rspec" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/rspec/092f87d5-3efe-42f4-8cc0-d84dec8e7298n%40googlegroups.com
>
> <https://groups.google.com/d/msgid/rspec/092f87d5-3efe-42f4-8cc0-d84dec8e7298n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/rspec/ff9bea09-488b-4218-868d-7a840ced825b%40app.fastmail.com.