seattlerb/minitest — pull request #161 by route (2012-09-11 16:34:57+00:00)
Title: Added another realization for capturing output

Original topic https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-core/iJ6VvC5igPk

Guys I decided to open PR because here we can discuss my code and these tests.

```ruby
require 'minitest/spec'
require 'minitest/autorun'

describe "Capture" do
it "should capture all output in the same process" do
out, err = capture_io do
puts "STDOUT"
warn "STDERR"
end

assert_equal "STDOUT\n", out
assert_equal "STDERR\n", err
end

# This test isn't capture output and get failure
it "should capture all output in subprocess" do
out, err = capture_io do
system("echo 'STDOUT'")
system("echo 'STDERR' 1>&2")
end

assert_equal "STDOUT\n", out
assert_equal "STDERR\n", err
end

# This works fine
it "should capture all output in subprocess with new method" do
out, err = full_capture_io do
system("echo 'STDOUT'")
system("echo 'STDERR' 1>&2")
end

assert_equal "STDOUT\n", out
assert_equal "STDERR\n", err
end
end
```