In some cases, Ruby uses higher precision to represent time than the DB. When we compare a timestamp before and after saving to the DB it might not be equal.
The easiest solution is to use
time = Time.now model = SomeModel.create(started_at: time) expect(model.started_at).to be_within(0.001.seconds).of(time)
Empty! You must sign in to add comments.