Comparison of DateTime
objects in nested data structures is failing when the objects are equal. Two separate tests that were comparing hashes that had DateTime
objects as values both failed on CircleCI, but passed locally (on multiple developer machines).
We are using:
rspec (3.2.0)
rails (4.2.1)
ruby 2.1.6
Examples of the two tests:
expect({ start_date: <A DateTime Object> }).to include({ start_date: <Another DateTime object> })
expect([ { start_date: <A DateTime Object> }, { start_date: <A DateTime Object> }]).to(
match_array([ { start_date: <A DateTime Object> }, { start_date: <A DateTime Object> }]
)
Both of these tests passed in CircleCI when to_s
was called on the DateTime
objects.