You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to a failed expectation running a diff on the objects involved, an expectation which involves sufficiently large ranges will iterate over every element of each range for message output upon failure. This is due to line 27 of lib/rspec/expectations/fail_with.rb
As you can see, if the range is of, say a date range spanning years, or a boundary is Float::INFINITY, the diff can take a lot of unnecessary time and screen space.
Suggested fix: wrap a conditional to check if expected or actual are ranges, and specialize output to deal with the boundaries of those ranges, rather than each element.
The text was updated successfully, but these errors were encountered:
This is because a range is enumberable, so treated like an array, we could add another special case to the diff code (like Ssruct and hash) or we could stop treating enumerables as arrays... WDYT @myronmarston
This. At least for diffs. If something is not an array, I think it would be confusing to represent it as one in the diff.
That said, the place where this is happening is Composable#surface_descriptions_in, which has other call sites and uses than just the differ -- and I'm not sure if we should continue treating enumerables as arrays for those uses or not. I need to think about it more.
Due to a failed expectation running a diff on the objects involved, an expectation which involves sufficiently large ranges will iterate over every element of each range for message output upon failure. This is due to line 27 of lib/rspec/expectations/fail_with.rb
Example:
will result in:
As you can see, if the range is of, say a date range spanning years, or a boundary is Float::INFINITY, the diff can take a lot of unnecessary time and screen space.
Suggested fix: wrap a conditional to check if expected or actual are ranges, and specialize output to deal with the boundaries of those ranges, rather than each element.
The text was updated successfully, but these errors were encountered: