Sha256: 35818ee2ebe2899da80e98bc6359dcb069b7d111c70b911f48f6fa464bc73ba1
Contents?: true
Size: 861 Bytes
Versions: 16
Compression:
Stored size: 861 Bytes
Contents
module Dynflow module Testing class ManagedClock attr_reader :pending_pings include Algebrick::Types def initialize @pending_pings = [] end def ping(who, time, with_what = nil, where = :<<) time = current_time + time if time.is_a? Numeric with = with_what.nil? ? None : Some[Object][with_what] @pending_pings << Clock::Timer[who, time, with, where] @pending_pings.sort! end def progress if next_ping = @pending_pings.shift # we are testing an isolated system = we can move in time # without actually waiting @current_time = next_ping.when next_ping.apply end end def current_time @current_time ||= Time.now end def clear @pending_pings.clear end end end end
Version data entries
16 entries across 16 versions & 1 rubygems