Permalink
Browse files

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.
  • Loading branch information...
jonleighton committed Mar 9, 2013
1 parent ca35454 commit 9ae81be072ef392cadd291c92889e7ca7c878f32
Showing with 2 additions and 2 deletions.
  1. +2 −2 railties/test/application/console_test.rb
@@ -106,13 +106,13 @@ def teardown
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

1 comment on commit 9ae81be

@carlosantoniodasilva

This comment has been minimized.

Show comment Hide comment
@carlosantoniodasilva

carlosantoniodasilva Mar 9, 2013

Owner

❤️

❤️

Please sign in to comment.