Ensures build_stubbed generates a record with equal created_at and updated_at.
Current behavior
Calling .build_stubbed on factories with entities that have created_at and updated_at assigns a slightly different time for each one of then because the code calls Time.current twice.
Expected behavior
I think the expected behavior should be for them to be exact the same.
Concerns
There are two concerns with the current solution:
We would be calling Time.current even if created_at and updated_at don't exist on the entity;
It might be a problem that we're assigning the same object to both timestamps, should we dup updated_at? (edit: dates are immutable, never mind :grimacing: :face_with_peeking_eye:).
I preferred to ask if these are valid concerns before investigating how to solve them.
Description
Ensures build_stubbed generates a record with equal created_at and updated_at.
Current behavior
Calling
.build_stubbed
on factories with entities that have created_at and updated_at assigns a slightly different time for each one of then because the code callsTime.current
twice.Expected behavior
I think the expected behavior should be for them to be exact the same.
Concerns
There are two concerns with the current solution:
Time.current
even if created_at and updated_at don't exist on the entity;It might be a problem that we're assigning the same object to both timestamps, should we(edit: dates are immutable, never mind :grimacing: :face_with_peeking_eye:).dup
updated_at?I preferred to ask if these are valid concerns before investigating how to solve them.