Remove SocketDebugger and deprecate socket_class
Because: * SocketDebugger is less useful than debug logging in the driver * SocketDebugger has been broken for several releases and is unused * The socket_class option was only used for injecting SocketDebugger This commit: * Removes the SocketDebugger class * Deprecates the socket_class option
This commit is contained in:
parent
30dc567202
commit
af06f696e1
|
@ -12,7 +12,13 @@ module Capybara::Webkit
|
|||
|
||||
def initialize(options = {})
|
||||
@socket = nil
|
||||
@socket_class = options[:socket_class] || TCPSocket
|
||||
if options.has_key?(:socket_class)
|
||||
warn '[DEPRECATION] The Capybara::Webkit::Connection `socket_class` ' \
|
||||
'option is deprecated without replacement.'
|
||||
@socket_class = options[:socket_class]
|
||||
else
|
||||
@socket_class = TCPSocket
|
||||
end
|
||||
if options.has_key?(:stderr)
|
||||
@output_target = options[:stderr]
|
||||
elsif options.has_key?(:stdout)
|
||||
|
|
|
@ -3,7 +3,6 @@ require "capybara/webkit/version"
|
|||
require "capybara/webkit/node"
|
||||
require "capybara/webkit/connection"
|
||||
require "capybara/webkit/browser"
|
||||
require "capybara/webkit/socket_debugger"
|
||||
require "capybara/webkit/cookie_jar"
|
||||
require "capybara/webkit/errors"
|
||||
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
# Wraps the TCP socket and prints data sent and received. Used for debugging
|
||||
# the wire protocol. You can use this by passing a :socket_class to Browser.
|
||||
module Capybara::Webkit
|
||||
class SocketDebugger
|
||||
def self.open(host, port)
|
||||
real_socket = TCPSocket.open(host, port)
|
||||
new(real_socket)
|
||||
end
|
||||
|
||||
def initialize(socket)
|
||||
@socket = socket
|
||||
end
|
||||
|
||||
def read(length)
|
||||
received @socket.read(length)
|
||||
end
|
||||
|
||||
def puts(line)
|
||||
sent line
|
||||
@socket.puts(line)
|
||||
end
|
||||
|
||||
def print(content)
|
||||
sent content
|
||||
@socket.print(content)
|
||||
end
|
||||
|
||||
def gets
|
||||
received @socket.gets
|
||||
end
|
||||
|
||||
def setsockopt(level, name, value)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def sent(content)
|
||||
Kernel.puts " >> " + content.to_s
|
||||
end
|
||||
|
||||
def received(content)
|
||||
Kernel.puts " << " + content.to_s
|
||||
content
|
||||
end
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@ $LOAD_PATH << File.join(PROJECT_ROOT, 'lib')
|
|||
Dir[File.join(PROJECT_ROOT, 'spec', 'support', '**', '*.rb')].each { |file| require(file) }
|
||||
|
||||
require 'capybara/webkit'
|
||||
$webkit_connection = Capybara::Webkit::Connection.new(:socket_class => TCPSocket)
|
||||
$webkit_connection = Capybara::Webkit::Connection.new
|
||||
$webkit_browser = Capybara::Webkit::Browser.new($webkit_connection)
|
||||
|
||||
if ENV['DEBUG']
|
||||
|
|
Loading…
Reference in New Issue