lib/cucumber/wire_support/connection.rb in cucumber-1.2.2 vs lib/cucumber/wire_support/connection.rb in cucumber-1.2.3
- old
+ new
@@ -24,11 +24,11 @@
raise Timeout::Error, "Timed out calling wire server with message '#{message}'", backtrace
end
end
def exception(params)
- WireException.new(params, @config.host, @config.port)
+ WireException.new(params, @config)
end
private
def send_data_to_socket(data)
@@ -45,12 +45,17 @@
raise exception({'message' => "Remote Socket with #{@config.host}:#{@config.port} closed."}) if raw_response.nil?
WirePacket.parse(raw_response)
end
def socket
- @socket ||= TCPSocket.new(@config.host, @config.port)
+ return @socket if @socket
+ if @config.unix
+ @socket = UNIXSocket.new(@config.unix)
+ else
+ @socket = TCPSocket.new(@config.host, @config.port)
+ end
rescue Errno::ECONNREFUSED => exception
- raise(ConnectionError, "Unable to contact the wire server at #{@config.host}:#{@config.port}. Is it up?")
+ raise(ConnectionError, "Unable to contact the wire server at #{@config}. Is it up?")
end
end
end
end