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` exactly once.
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` exactly once.
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 ` exactly once .
def assert_callback(time = nil, message = nil)
    called_back = false
    EventMachine.next_tick do
      yield(lambda { called_back = true })
    end
    start_time = Time.now.to_i
    while (!called_back)
      select(nil, nil, nil, 0.1)
      if (time and (Time.now.to_i - start_time > time))
        flunk(message || 'assert_callback timed out')
      end
    end
  end
def assert_callback ( time = nil , message = nil ) called_back = false EventMachine . next_tick do yield ( lambda { called_back = true } ) end start_time = Time . now . to_i while ( ! called_back ) select ( nil , nil , nil , 0.1 ) if ( time and ( Time . now . to_i - start_time > time ) ) flunk ( message || 'assert_callback timed out' ) 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 .
time
<not_specific>
message
<not_specific>