diff --git a/lib/capybara/webkit/connection.rb b/lib/capybara/webkit/connection.rb index 6852301..4df5279 100644 --- a/lib/capybara/webkit/connection.rb +++ b/lib/capybara/webkit/connection.rb @@ -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) diff --git a/lib/capybara/webkit/driver.rb b/lib/capybara/webkit/driver.rb index aaf5f80..4cfc248 100644 --- a/lib/capybara/webkit/driver.rb +++ b/lib/capybara/webkit/driver.rb @@ -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" diff --git a/lib/capybara/webkit/socket_debugger.rb b/lib/capybara/webkit/socket_debugger.rb deleted file mode 100644 index 332013c..0000000 --- a/lib/capybara/webkit/socket_debugger.rb +++ /dev/null @@ -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 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b2a3c94..ad0c448 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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']