Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Delorean lets you travel in time with Ruby by mocking Time.now
Ruby
Tag: v0.1.0

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
MIT-LICENSE
README.rdoc
Rakefile

README.rdoc

Delorean

Delorean let you time-travel with Ruby by mocking Time.now

Install

$ [sudo] gem install delorean

Usage

# Time.now => Wed Feb 24 00:33:09 +0100 2010
Delorean.time_travel_to "1 month ago" 
# Time.now => Sun Jan 24 00:33:09 +0100 2010
Delorean.back_to_the_present
# Time.now => Wed Feb 24 00:33:09 +0100 2010

Delorean.time_travel_to("1 month ago") do 
  # Inside the block: 
  # Time.now => Sun Jan 24 00:34:32 +0100 2010
  sleep(5)
  # And the time still goes on... Time.now => Sun Jan 24 00:34:37 +0100 2010
end
# Outside the block: 
# Time.now => Wed Feb 24 00:34:35 +0100 2010

# Time.now => Wed Feb 24 00:34:04 +0100 2010
Delorean.jump 30
# Time.now => Wed Feb 24 00:34:34 +0100 2010

Copyright © 2010 Luismi Cavallé, Sergio Gil and BeBanjo S.L. released under the MIT license

Something went wrong with that request. Please try again.