Add thorough tests for Time-object #past?, #future? and #today. Fix TimeWithZone #today? to use #time instead of #utc for date comparison. Update changelog. [#720 state:resolved]
Hmmm… you should be testing that remember_token_expires_at equals a specific time value, rather than using #between?
I’d suggest stubbing out Time.now to a specific time which will make it easier to test that remember_token_expires_at is set to exactly two weeks after that:
Time.stubs(:now).returns Time.utc(2000,1,1) users(:quentin).remember_me assert_equal Time.utc(2000,1,15), users(:quentin).remember_token_expires_at
P.S., I hate this
TimeWithZone: when crossing DST boundary, treat Durations of days, months or years as variable-length, and all other values as absolute length. A time + 24.hours will advance exactly 24 hours, but a time + 1.day will advance 23-25 hours, depending on the day. Ensure consistent behavior across all advancing methods