Slide 136
Slide 136 text
Well…
* For IO-based issues, you can substitute StringIO for other kinds of IO in your spec. I’ll share an example of this in a moment.
* You can test that the correct messages are being sent between collaborating objects, rather than testing the return value of a method.
* You can write thread-safe code.
* You can test threaded code synchronously - by extracting the guts of the thread into a plain old Ruby object (or PORO) and testing that, or
* You can switch to fibers instead of threads
Fibers are cool, because you can test them synchronously which is awesome. They significantly reduce the chances of a race condition, because they’re in control of when they relinquish the CPU back to the OS. So, atomic operations can complete without interruption.
* Finally, you can always add more resources to your test environment. Though, that’s a bit of an arms race. You’ll most likely end up come back and increasing it again, and again, and again.