Hello,
I am a happy webmock user. However, I recently came across a situation where webmock did not seem to meet my needs. I am working on building an API client for an API that uses TCP sockets. I have embarrassingly little experience working with sockets, but reviewing the code that is used to interact with the API, it seems like it might not be too difficult to mock. Here's a snippet of the code:
# connect to the API
@connection = TCPSocket.
new(
@server,
@port)
@socket = OpenSSL::
SSL::
SSLSocket.
new(
@connection)
if @connection
# send a command to the API
if @socket and not @socket.closed?
@socket.write("SOME API COMMAND")
end
# read the response
line = @socket.gets # actually loop until all lines are read
@socket.close if @socket and not @socket.closed?
@connection.close if @connection and not @connection.closed?
My question is whether or not webmock would be interested in supporting these types of API requests, or would be better suited for a different library. Or better yet, is this kind of mocking already implemented in a gem that I don't yet know about?
Thanks,
Andrew Havens