Displaying 1 result from an estimated 1 matches for "valid_protocol".
Did you mean:
ali_protocol
2006 Dec 15
5
Testing event driven Socket classes
...se look in the code, carefully. most of the methods in class are
actually callbacks, which respond to certain events.
Is it possible to unit test this with Mocha?
require "eventmachine"
class TickServer < EventMachine::Connection
attr_accessor :chunked_data,:client_status
def valid_protocol? data
return false unless data =~ /(\d{3})([^<>]*)<([^><]*)>##(.*?)##/
return true
end
# method is a callback, gets called whenever data is there in socket to read
def receive_data data
data.chomp!
while data && data.length > 0
data_array =...