diff options
author | Jon Leighton <j@jonathanleighton.com> | 2013-03-09 20:32:01 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2013-03-09 20:32:01 +0000 |
commit | 9ae81be072ef392cadd291c92889e7ca7c878f32 (patch) | |
tree | 2861228d26de1eaed841c910b4cc617a264150e9 /railties/test/application | |
parent | ca35454b498657cd94cb0a4203801e52687aa9e0 (diff) | |
download | rails-9ae81be072ef392cadd291c92889e7ca7c878f32.tar.gz rails-9ae81be072ef392cadd291c92889e7ca7c878f32.tar.bz2 rails-9ae81be072ef392cadd291c92889e7ca7c878f32.zip |
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.
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/console_test.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/test/application/console_test.rb b/railties/test/application/console_test.rb index f4450c8a3c..af495bb450 100644 --- a/railties/test/application/console_test.rb +++ b/railties/test/application/console_test.rb @@ -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 |