Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit 9ae81be072ef392cadd291c92889e7ca7c878f32 1 parent ca35454
@jonleighton jonleighton authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 railties/test/application/console_test.rb
View
4 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

Please sign in to comment.
Something went wrong with that request. Please try again.