Skip to content

Instantly share code, notes, and snippets.

@aditya
Created October 8, 2009 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aditya/205445 to your computer and use it in GitHub Desktop.
Save aditya/205445 to your computer and use it in GitHub Desktop.
def freeze_time(*times)
if times.empty?
times << Time.at(Time.now.to_i) # Truncate seconds
end
Time.stubs(:now).returns(*times)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment