diff options
author | Rafael Mendonça França <rafael.franca@plataformatec.com.br> | 2014-09-11 00:55:05 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafael.franca@plataformatec.com.br> | 2014-09-11 00:55:05 -0300 |
commit | 1245a9e06c66e77813fda621e825afdeacf2cd49 (patch) | |
tree | 14f884e310afcef08ab9fc86c5ba79e9fdbdb6ad /railties/test | |
parent | 53e877f7d9291b2bf0b8c425f9e32ef35829f35b (diff) | |
download | rails-1245a9e06c66e77813fda621e825afdeacf2cd49.tar.gz rails-1245a9e06c66e77813fda621e825afdeacf2cd49.tar.bz2 rails-1245a9e06c66e77813fda621e825afdeacf2cd49.zip |
Always define capture to remove the deprecation message
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 |