1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
Description: Fix race in tests.
Author: Alexander Gerasiov <gq@debian.org>
Last-Update: 2015-02-19
Forwarded: https://github.com/jpastuszek/capture-output/pull/1
Index: ruby-capture-output-1.0.0/spec/capture-output_spec.rb
===================================================================
--- ruby-capture-output-1.0.0.orig/spec/capture-output_spec.rb 2015-02-19 02:02:10.000000000 +0300
+++ ruby-capture-output-1.0.0/spec/capture-output_spec.rb 2015-02-19 02:27:48.107669177 +0300
@@ -3,14 +3,16 @@
describe Capture do
it "#stdout should capture all STDOUT IO content" do
Capture.stdout do
- Process.spawn('echo "hello world"')
+ pid = Process.spawn('echo "hello world"')
+ Process.wait pid
STDOUT.puts 'puts'
end.should == "hello world\nputs\n"
end
it "#stderr should capture all STDERR IO content" do
Capture.stderr do
- Process.spawn('echo "hello world" 1>&2')
+ pid = Process.spawn('echo "hello world" 1>&2')
+ Process.wait pid
STDERR.puts 'puts'
end.should == "hello world\nputs\n"
end
@@ -18,8 +20,10 @@
it "#stdout and #stderr in combination" do
Capture.stdout do
Capture.stderr do
- Process.spawn('echo "hello world out"')
- Process.spawn('echo "hello world err" 1>&2')
+ pid = Process.spawn('echo "hello world out"')
+ Process.wait pid
+ pid = Process.spawn('echo "hello world err" 1>&2')
+ Process.wait pid
end.should == "hello world err\n"
end.should == "hello world out\n"
end
|