← Graph

Time.current Testing Trap

concept 3 connections

Pattern Rodzik singles out at the end of the talk: `Time.current` (or `Time.now`) looks simple but is functionally a random source — every caller gets a different value. Ruby developers reach for RSpec's `travel_to`/time-travel helpers to control it; Rodzik's original claim is that time travel is the 'only option'. An audience member challenges this and suggests two alternatives: algebraic effects, and dependency-injecting a current-time object per request/process. Rodzik agrees both are better but notes time-travel helpers still pervade real codebases.

category
practice
about
Time.current Testing Trap concept
Closing example: Time.current is a hidden random source and motivates the 'understand, extract, control' prescription.
about
Time.current Testing Trap concept
Closing example making the general principle concrete.
about
Time.current Testing Trap concept
Discusses how to properly test current-time dependencies.

Provenance

Read by
7 extractions