Rails TimeHelpers
Rails ActiveSupport testing library includes some really helpful methods for manipulating time.
Here's a cool one:
travel_to Time.new(2022, 9, 14) do
#everything inside this block is now happening as if it is 9-14-2022
end
# afterwards we return to the present
This way you can test all sorts of time-based features by jumping back and forth through time.
Trippy 🔮
Tweet