aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/deprecation_test.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-07-15 17:56:27 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-07-15 17:56:27 -0300
commit3121412cf181388f8dac71f2d707be2cbb764524 (patch)
tree5e0389e9c50d446a0c5dbcf384a6176bd2fe4934 /activesupport/test/deprecation_test.rb
parentaf2ffa8c79e69f99f6eec0aac76737a050bbd06e (diff)
downloadrails-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.rb17
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