module Timecop

Extended Modules

Defined in:

timecop.cr
timecop/exceptions.cr
timecop/time_stack_item.cr
timecop/version.cr

Constant Summary

VERSION = "0.2.0"

Instance Method Summary

Instance Method Detail

def freeze(time : Time) #

Allows you to run a block of code and "fake" a time throughout the execution of that block.


[View source]
def freeze(time : Time, &block : Time -> ) #

Allows you to run a block of code and "fake" a time throughout the execution of that block.


[View source]
def frozen? #

Returns whether or not Timecop is currently frozen/travelled/scaled


[View source]
def return #

Reverts back to system's Time.now


[View source]
def return(&) #

Reverts back to system's Time.now


[View source]
def safe_mode=(safe) #

[View source]
def safe_mode? #

[View source]
def scale(time : Time, factor : Float64) #

Allows you to run a block of code and "scale" a time throughout the execution of that block. The first argument is a scaling factor, for example: Timecop.scale(2) do ... time will 'go' twice as fast here end Returns the value of the block if one is given, or the mocked time.


[View source]
def scale(time : Time, factor : Float64, &block : Time -> ) #

[View source]
def travel(time : Time) #

Allows you to run a block of code and "fake" a time throughout the execution of that block.


[View source]
def travel(time : Time, &block : Time -> ) #

[View source]