13 lines
260 B
Ruby
13 lines
260 B
Ruby
# If you are getting an error `uninitialized constant StringIO` make sure that
|
|
# your code is in an `it` block.
|
|
|
|
# Helper that captures STDOUT.
|
|
def capture_stdout
|
|
output = StringIO.new
|
|
$stdout = output
|
|
yield
|
|
output.string
|
|
ensure
|
|
$stdout = STDOUT
|
|
end
|