Sha256: 73f1ab10231881f6d8ec4df5960be7cb566bd6d5d67bbd3ba10b6ae6b55f74f6
Contents?: true
Size: 455 Bytes
Versions: 57
Compression:
Stored size: 455 Bytes
Contents
# This class encapsulates the pattern of faking STD IO and exposing the streams # for testing. class FauxIO def initialize(&_block) original_stdout = $stdout original_stderr = $stderr $stdout = @stdout = StringIO.new $stderr = @stderr = StringIO.new yield rescue SystemExit ensure $stdout = original_stdout $stderr = original_stderr end def stdout @stdout.string end def stderr @stderr.string end end
Version data entries
57 entries across 57 versions & 1 rubygems