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