Stubbing out Connections • Efficient way to test apps that depends on external components • But we can’t tell whether or not our apps work well indeed against real servers
1. Fork a child process for a TCP server 2. Find an empty port for the server 3. Exec the server program using the port 4. Destroy the child process when it’s no longer needed
1. Fork a child process for a TCP server 2. Find an empty port for the server 3. Exec the server program using the port 4. Destroy the child process when it’s no longer needed
http://ruby-doc.org/core-2.0/ObjectSpace.html “ObjectSpace also provides support for object finalizers, procs that will be called when a specific object is about to be destroyed by garbage collection.”