class XSpec::Scheduler::Serial
The serial scheduler, unsurprisingly, runs all units of works serially in a loop. It is about as simple a scheduler as you can imagine. Parents are responsible for actually executing the work.
Attributes
clock[R]
Public Class Methods
new(opts = {})
click to toggle source
# File lib/xspec/schedulers.rb, line 11 def initialize(opts = {}) @clock = opts.fetch(:clock, ->{ Time.now.to_f }) end
Public Instance Methods
run(context, config)
click to toggle source
# File lib/xspec/schedulers.rb, line 15 def run(context, config) notifier = config.fetch(:notifier) notifier.run_start(config) context.nested_units_of_work.each do |x| notifier.evaluate_start(x) start_time = clock.() errors = x.immediate_parent.execute(x) finish_time = clock.() result = ExecutedUnitOfWork.new(x, errors, finish_time - start_time) notifier.evaluate_finish(result) end notifier.run_finish end