Ruby 2.7 separated
Time#to_s
method from Time#inspect
.
They were separated due to some troubles in the comparison of Time objects whose fractional parts were different.
For example, there are multiple time objects which are generated in a single HTTP request.
They would be definitely different by some seconds. So assert_equal
should fail.
But when we use assert_equal
with inspect
, it will return true as the fractional parts are ignored.
Before Ruby 2.7.0
In Ruby 2.7.0
As seen above the fractional part is now not ignored when we use inspect
.