Skip to main content

travel_to

Function travel_to 

Source
pub fn travel_to(unix: i64)
Expand description

Makes crate::now return unix on this thread until travel_back (Rails’ travel_to, frozen). Each Rust test runs on its own thread, so other tests keep the real clock. Affects code running in the test process (models, helpers, JWT), not the cf dev server.

§Examples

ocre::testing::travel_to(1_767_225_600); // 2026-01-01T00:00:00Z
assert_eq!(ocre::now(), 1_767_225_600);
ocre::testing::travel_back();