module TemporalHelpers
TemporalHelpers
module group all the needed methods to use Timecop with Cucumber
@author [zedtux]
Public Instance Methods
freeze_time_at(time, &block)
click to toggle source
Travels to and freezes the clock at time
.
If a block is given, executes the block at that time then returns to the present.
# File lib/cucumber/timecop.rb, line 23 def freeze_time_at(time, &block) Timecop.freeze parse_time(time), &block end
travel_to(time, &block)
click to toggle source
Travels to time
and lets the clock keep running.
If a block is given, executes the block at that time then returns to the present.
# File lib/cucumber/timecop.rb, line 15 def travel_to(time, &block) Timecop.travel parse_time(time), &block end
Private Instance Methods
parse_time(time)
click to toggle source
# File lib/cucumber/timecop.rb, line 29 def parse_time(time) Chronic.parse(time) || Time.parse(time) end