lib/asynchro/test_helper.rb
# Tests and re-tests assertions until all of them will pass. An optional
# limit on time can be specified in seconds. A short delay is introduced
# between tests to avoid monopolizing the CPU during testing. When the
# supplied block fails to produce an exception it is presumed to have been
# a successful test and execution will continue as normal.
Tests and re-tests assertions until all of them will pass. An optional
limit on time can be specified in seconds. A short delay is introduced
between tests to avoid monopolizing the CPU during testing. When the
supplied block fails to produce an exception it is presumed to have been
a successful test and execution will continue as normal.
Tests and re - tests assertions until all of them will pass . An optional limit on time can be specified in seconds . A short delay is introduced between tests to avoid monopolizing the CPU during testing . When the supplied block fails to produce an exception it is presumed to have been a successful test and execution will continue as normal .
def assert_eventually(time = nil, message = nil)
    end_time = (time and Time.now + time)
    exception = nil
    while (true)
      begin
        yield
      rescue Object => e
        exception = e
      else
        break
      end
      select(nil, nil, nil, 0.1)
      if (end_time and Time.now > end_time)
        if (exception)
          raise exception
        else
          flunk(message || 'assert_eventually timed out')
        end
      end
    end
  end
def assert_eventually ( time = nil , message = nil ) end_time = ( time and Time . now + time ) exception = nil while ( true ) begin yield rescue Object => e exception = e else break end select ( nil , nil , nil , 0.1 ) if ( end_time and Time . now > end_time ) if ( exception ) raise exception else flunk ( message || 'assert_eventually timed out' ) end end end end
Tests and re-tests assertions until all of them will pass.
Tests and re - tests assertions until all of them will pass .
time
<not_specific>
message
<not_specific>