diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-07-15 17:56:27 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-07-15 17:56:27 -0300 |
commit | 3121412cf181388f8dac71f2d707be2cbb764524 (patch) | |
tree | 5e0389e9c50d446a0c5dbcf384a6176bd2fe4934 /activesupport/test/deprecation_test.rb | |
parent | af2ffa8c79e69f99f6eec0aac76737a050bbd06e (diff) | |
download | rails-3121412cf181388f8dac71f2d707be2cbb764524.tar.gz rails-3121412cf181388f8dac71f2d707be2cbb764524.tar.bz2 rails-3121412cf181388f8dac71f2d707be2cbb764524.zip |
Keep quietly and capture undeprecated on your suite
Diffstat (limited to 'activesupport/test/deprecation_test.rb')
-rw-r--r-- | activesupport/test/deprecation_test.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/activesupport/test/deprecation_test.rb b/activesupport/test/deprecation_test.rb index ee1c69502e..7aff56cbad 100644 --- a/activesupport/test/deprecation_test.rb +++ b/activesupport/test/deprecation_test.rb @@ -355,4 +355,21 @@ class DeprecationTest < ActiveSupport::TestCase end deprecator 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 |