Method: Timecop.travel

Defined in:
lib/timecop/timecop.rb

.travel(*args, &block) ⇒ Object

Allows you to run a block of code and “fake” a time throughout the execution of that block. See Timecop#freeze for a sample of how to use (same exact usage syntax)

  • Note: Timecop.travel will not freeze time (as opposed to Timecop.freeze). This is a particularly good candidate for use in environment files in rails projects.

Returns the value of the block if one is given, or the mocked time.



68
69
70
# File 'lib/timecop/timecop.rb', line 68

def travel(*args, &block)
  send_travel(:travel, *args, &block)
end