diff options
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/abstract_unit.rb | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/railties/test/abstract_unit.rb b/railties/test/abstract_unit.rb index 3810f0e14f..0749615d03 100644 --- a/railties/test/abstract_unit.rb +++ b/railties/test/abstract_unit.rb @@ -34,22 +34,20 @@ class ActiveSupport::TestCase private - unless defined?(:capture) - def capture(stream) - stream = stream.to_s - captured_stream = Tempfile.new(stream) - stream_io = eval("$#{stream}") - origin_stream = stream_io.dup - stream_io.reopen(captured_stream) - - yield - - stream_io.rewind - return captured_stream.read - ensure - captured_stream.close - captured_stream.unlink - stream_io.reopen(origin_stream) - end + def capture(stream) + stream = stream.to_s + captured_stream = Tempfile.new(stream) + stream_io = eval("$#{stream}") + origin_stream = stream_io.dup + stream_io.reopen(captured_stream) + + yield + + stream_io.rewind + return captured_stream.read + ensure + captured_stream.close + captured_stream.unlink + stream_io.reopen(origin_stream) end end |