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