Flowdock
method

travel_back

Importance_2
v7.1.3.2 - Show latest stable - 0 notes - Class: TimeHelpers
travel_back() public

Returns the current time back to its original state, by removing the stubs added by travel, travel_to, and freeze_time.

Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00

travel_to Time.zone.local(2004, 11, 24, 1, 4, 44)
Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00

travel_back
Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00

This method also accepts a block, which brings the stubs back at the end of the block:

Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00

travel_to Time.zone.local(2004, 11, 24, 1, 4, 44)
Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00

travel_back do
  Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
end

Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
Show source
Register or log in to add new notes.