module WireHelper

Attributes

messages_received[R]

Public Instance Methods

start_wire_server() click to toggle source
# File features/step_definitions/wire_steps.rb, line 27
def start_wire_server
  @messages_received = []
  reader, writer = IO.pipe
  @wire_pid = fork {
    reader.close
    @server.run(writer)
  }
  writer.close
  Thread.new do
    while message = reader.gets
      @messages_received << message.strip
    end
  end
  at_exit { stop_wire_server }
end
stop_wire_server() click to toggle source
# File features/step_definitions/wire_steps.rb, line 43
def stop_wire_server
  return unless @wire_pid
  Process.kill('KILL', @wire_pid)
  Process.wait(@wire_pid)
rescue Errno::ESRCH
  # No such process - wire server has already been stopped by the After hook
end