Skip to content

Instantly share code, notes, and snippets.

@shageman
Created March 10, 2010 14:32
Show Gist options
  • Save shageman/327914 to your computer and use it in GitHub Desktop.
Save shageman/327914 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