Use a pipe to test stderr forwarding

* Assertion was accidentally removed when testing #read as an
  alternative.
This commit is contained in:
Matthew Horan 2014-01-28 22:01:58 -05:00
parent e38934a5ed
commit d787215939
1 changed files with 5 additions and 3 deletions

View File

@ -19,8 +19,8 @@ describe Capybara::Webkit::Connection do
end
it 'forwards stderr to the given IO object' do
io = StringIO.new
redirected_connection = Capybara::Webkit::Connection.new(:stderr => io)
read, write = IO.pipe
redirected_connection = Capybara::Webkit::Connection.new(:stderr => write)
script = 'console.log("hello world")'
redirected_connection.puts "EnableLogging"
redirected_connection.puts 0
@ -28,7 +28,9 @@ describe Capybara::Webkit::Connection do
redirected_connection.puts 1
redirected_connection.puts script.to_s.bytesize
redirected_connection.print script
io.read(11) =~ /hello world $/
sleep(0.5)
write.close
read.read.should =~ /hello world $/
end
it 'does not forward stderr to nil' do