super_diff
super_diff copied to clipboard
When comparing arrays with nil values, NilClass is showing up in diff

We could treat nil
and other primitives as un-diffable against the HavingAttributes matcher. I don't particularly like that because nil
actually does have attributes {to_s: '', to_i: 0}
and so on; SuperDiff would break if you're testing that the actual
object matches one of those interfaces.
Even deeper of an issue is that we try to intelligently compare array elements when using the eq
expectation between arrays. Per the Ruby docs, arrays are ==
if when the arrays are the same length and each corresponding element is equal per the ==
operator. We shouldn't use fuzzy comparison when using the eq
matcher, but unfortunately, by the time RSpec calls into SuperDiff, we've lost context on what the failed matcher even was. I'm not sure how to address that.