Ruby DocTest is a tool that lets you put irb-style tests in your documentation. It’s similar to Python’s doctest, but different in several ways.
sudo gem install rubydoctest
Ruby DocTest was written by Tom Locke, Duane Johnson, Nic Williams and Clinton Forbes/Roger Pack. Roger and Tom are the original authors of two separate “doctest” packages, now combined and superseded by this project.
Ruby DocTest is released under the MIT License, meaning you can do whatever you want with it (repackage it, use it for commercial purposes, whatever you’d like) as long as you don’t hold us responsible for anything.