ackama / rails-template

Application template for Rails 7 projects; preloaded with best practices for TDD, security, deployment, and developer productivity.
Other
294 stars 15 forks source link

Fix DST causing sign in spec to fail #540

Closed robotdana closed 4 months ago

robotdana commented 5 months ago

The issue seems to be that within the next 2 weeks is a dst change so we aren't 14 days away, we're 14 days +- 1 hour away (i can't be bothered figuring out which direction currently), which when rounded to days at utc was sometimes out by a day

by keeping the comparison to datetimes rather than a raw number of days or seconds, then ruby/rails can keep track of the impact of dst and things will just work

i've included the time helpers setup in base rather than in just the devise variant because i think it's broadly useful and its provided by rails we might as well make it accessible to rspec