features/lib/support/fake_wire_server.rb in cucumber-3.0.0.pre.1 vs features/lib/support/fake_wire_server.rb in cucumber-3.0.0.pre.2

- old
+ new

@@ -41,18 +41,23 @@ @delays = delays @on_message = on_message end def start - while message = @socket.gets + message = @socket.gets + + while message handle(message) + message = @socket.gets end end private def handle(data) - if protocol_entry = response_to(data.strip) + protocol_entry = response_to(data.strip) + + if protocol_entry sleep delay(data) @on_message.call(MultiJson.load(protocol_entry['request'])[0]) send_response(protocol_entry['response']) else serialized_exception = { :message => "Not understood: #{data}", :backtrace => [] }