Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A Rails plugin that makes it easy to write tests or specs for time-dependent code

tree: 2c7350ef2e

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 coverage
Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 MIT-LICENSE Initial import. March 09, 2008
Octocat-spinner-32 README
Octocat-spinner-32 Rakefile
Octocat-spinner-32 init.rb Initial import. March 09, 2008
= TimeTravel

This lets you set the current time in your tests or specs, so you can do
things like:

  at_time("1 April 2020 2:32 UTC") do
    # some fancy code
Inside the block, will return the time you provide. The time will
be restored to normal system time when the block exits, even if it throws
an exception.

The at_time function can take a Time object, or a string to parse into a time.

TimeTravel is only loaded in the Rails test environment. If you need it in
your development environment, just require 'time_travel'.
Something went wrong with that request. Please try again.