Skip to content

Instantly share code, notes, and snippets.

@schlick
Forked from shageman/Time travel steps
Created April 26, 2010 13:53
Show Gist options
  • Save schlick/379352 to your computer and use it in GitHub Desktop.
Save schlick/379352 to your computer and use it in GitHub Desktop.
When /^(\d+) (minutes|hours|days) pass$/ do |amount, unit|
now = Time.now
Time.stubs(:now).returns(now + amount.to_i.send(unit.to_sym))
end
When /^going back (\d+) (minutes|hours|days)$/ do |minutes|
now = Time.now
Time.stubs(:now).returns(now - amount.to_i.send(unit.to_sym))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment