lib/asynchro/test_helper.rb
# Asserts that a callback is made within a specified time, or will wait
# forever for the callback to occur if no time is specified. The supplied
# block will be called with the callback Proc which should be executed
# using `call` as many times as specified, or 1 by default.
Asserts that a callback is made within a specified time, or will wait
forever for the callback to occur if no time is specified. The supplied
block will be called with the callback Proc which should be executed
using `call` as many times as specified, or 1 by default.
Asserts that a callback is made within a specified time or will wait forever for the callback to occur if no time is specified . The supplied block will be called with the callback Proc which should be executed using ` call ` as many times as specified or 1 by default .
def assert_callback_times(count = 1, time = nil, message = nil)
    called_back = 0
    EventMachine.next_tick do
      yield(lambda { called_back += 1 })
    end
    start_time = Time.now.to_i
    while (called_back < count)
      select(nil, nil, nil, 0.1)
      if (time and (Time.now.to_i - start_time > time))
        flunk(message || "assert_callback_times timed out at only #{count} times")
      end
    end
  end
def assert_callback_times ( count = 1 , time = nil , message = nil ) called_back = 0 EventMachine . next_tick do yield ( lambda { called_back += 1 } ) end start_time = Time . now . to_i while ( called_back < count ) select ( nil , nil , nil , 0.1 ) if ( time and ( Time . now . to_i - start_time > time ) ) flunk ( message || "assert_callback_times timed out at only #{count} times" ) end end end
Asserts that a callback is made within a specified time, or will wait
forever for the callback to occur if no time is specified.
Asserts that a callback is made within a specified time or will wait forever for the callback to occur if no time is specified .
count
<not_specific>
time
<not_specific>
message
<not_specific>