Hacker GitHub

← All repos

travisjeffery/timecop

View on GitHub ↗ ★ 3,424 Ruby

A gem providing "time travel", "time freezing", and "time acceleration" capabilities, making it simple to test time-dependent code. It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call.

5 mentions on Hacker News by 4 people: 0 stories, 5 comments · first 2012-12-11 · latest 2026-04-21

Mentions per year 5 mentions · busiest year 2012 (1)
20082026
  1. Ruby's timecop is great for those test scenarios https://github.com/travisjeffery/timecop
  2. The Ruby equivalent is Timecop https://github.com/travisjeffery/timecop Dynamic languages have the advantage to be able to rewrite the standard library classes at runtime.
  3. …there is a ruby testing library with the same name that's somewhat well-known (~3K stars on github) https://github.com/travisjeffery/timecop
  4. eek. Time tests should be using something like https://github.com/travisjeffery/timecop for repeatability. If you do mean to allow random starting values like that, you should look into property-based testing…
    comment by bazzargh · 2015-06-05 · in When a+b+c does not equal c+b+a
  5. …out either of the following libs. As far as I can tell they differ only in their pun selection. https://github.com/travisjeffery/timecop https://github.com/bebanjo/delorean In the ruby community, disliking someone's choice of science…
    comment by JonnieCache · 2012-12-11 · in FreezeGun: easy mocking of Python datetimes