Class: Timecop::Rspec::SequentialTimeMachine

Inherits:
Object
  • Object
show all
Defined in:
lib/timecop/rspec/sequential_time_machine.rb

Overview

Executes examples while allowing time travel to continue across examples.

Uses TravelLog to coalesce sequential :travel operations when the same method and start time are reused, enabling long-running time journeys across multiple examples.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.instanceTimecop::Rspec::SequentialTimeMachine

Singleton instance accessor.



15
16
17
# File 'lib/timecop/rspec/sequential_time_machine.rb', line 15

def self.instance
  @instance ||= new
end

Instance Method Details

#run(example) ⇒ Object

Run an example with either local or global travel, or without any timecop.

Parameters:

  • example (#run, #metadata)

Returns:

  • (Object)


22
23
24
25
26
# File 'lib/timecop/rspec/sequential_time_machine.rb', line 22

def run(example)
  example = ExampleDecorator.new(example)

  runner_for(example).run
end