1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix race condition in test

This should fix travis. For real this time! This is the one!

The readpartial(100) meant that an earlier assert_stdout could chomp up
the output that a later assert_stdout wants, meaning that the later
assertion fails.

Reading only 1 byte at a time ensure that we don't read any more than is
necessary to verify the assertion.
This commit is contained in:
Jon Leighton 2013-03-09 20:32:01 +00:00
parent ca35454b49
commit 9ae81be072

View file

@ -106,13 +106,13 @@ class FullStackConsoleTest < ActiveSupport::TestCase
teardown_app
end
def assert_output(expected, timeout = 5)
def assert_output(expected, timeout = 1)
timeout = Time.now + timeout
output = ""
until output.include?(expected) || Time.now > timeout
if IO.select([@master], [], [], 0.1)
output << @master.readpartial(100)
output << @master.read(1)
end
end