mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00
Use a pipe to test stderr forwarding
* Assertion was accidentally removed when testing #read as an alternative.
This commit is contained in:
parent
e38934a5ed
commit
d787215939
1 changed files with 5 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue