new

new(utc_time, time_zone, local_time = nil, period = nil) Class Public methods

name

name() Class Public methods Report class name as 'Time' to thwart type checking.

travel_to

travel_to(date_or_time, &block) Instance Public methods Changes current time to the given time by stubbing Time.now and Date.today to return the time or date passed into this method. Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 travel_to Time.new(2004, 11, 24, 01, 04, 44) Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 Date.current # => Wed, 24 Nov 2004 Dates are taken as their timestamp at the beginning of the day in the application time zone. Time.c

travel_back

travel_back() Instance Public methods Returns the current time back to its original state, by removing the stubs added by `travel` and `travel_to`. Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 travel_to Time.new(2004, 11, 24, 01, 04, 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

travel

travel(duration, &block) Instance Public methods Changes current time to the time in the future or in the past by a given time difference by stubbing Time.now and Date.today. Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 travel 1.day Time.current # => Sun, 10 Nov 2013 15:34:49 EST -05:00 Date.current # => Sun, 10 Nov 2013 This method also accepts a block, which will return the current time back to its original state at the end of the block: Time.current # =&g

teardown

teardown(*args, &block) Instance Public methods Add a callback, which runs after TestCase#teardown.

setup

setup(*args, &block) Instance Public methods Add a callback, which runs before TestCase#setup.

run

run() Instance Public methods

_run_class_setup

_run_class_setup() Instance Public methods

forking_env?

forking_env?() Class Public methods