Skip to content

Instantly share code, notes, and snippets.

@garethrees
Created July 3, 2012 10:51
Show Gist options
  • Select an option

  • Save garethrees/3039032 to your computer and use it in GitHub Desktop.

Select an option

Save garethrees/3039032 to your computer and use it in GitHub Desktop.
Fake Time.now and Time.zone.now
$start = Time.now - 1.month # this time last month
class Time
class << Time
def new
$start
end
def now
Time.new
end
end
end
class TimeWithZone
class << TimeWithZone
def new
$start
end
def now
Time.new
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment