Permalink
Browse files

Use a pipe to test stderr forwarding

* Assertion was accidentally removed when testing #read as an
  alternative.
  • Loading branch information...
1 parent e38934a commit d78721593961e1b29a326800d0d91c1cf90991b3 @mhoran mhoran committed Jan 29, 2014
Showing with 5 additions and 3 deletions.
  1. +5 −3 spec/connection_spec.rb
View
@@ -19,16 +19,18 @@
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
redirected_connection.puts "Execute"
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

0 comments on commit d787215

Please sign in to comment.