diff options
author | Akira Matsuda <ronnie@dio.jp> | 2013-01-23 08:20:58 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2013-01-23 13:29:40 +0900 |
commit | ffd0dd31f8065903471895bf95ade061a488142b (patch) | |
tree | 3134952cac0923ff2b797d409453efd9285ba24c /activesupport | |
parent | 36ff09d7da72dbb4b55229cbf76b3b316775625f (diff) | |
download | rails-ffd0dd31f8065903471895bf95ade061a488142b.tar.gz rails-ffd0dd31f8065903471895bf95ade061a488142b.tar.bz2 rails-ffd0dd31f8065903471895bf95ade061a488142b.zip |
Test Kernel#quietly
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/test/core_ext/kernel_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/kernel_test.rb b/activesupport/test/core_ext/kernel_test.rb index 1583c1fa32..b8951de402 100644 --- a/activesupport/test/core_ext/kernel_test.rb +++ b/activesupport/test/core_ext/kernel_test.rb @@ -38,6 +38,18 @@ class KernelTest < ActiveSupport::TestCase # Skip if we can't STDERR.tell end + def test_quietly + old_stdout_position, old_stderr_position = STDOUT.tell, STDERR.tell + quietly do + puts 'see me, feel me' + STDERR.puts 'touch me, heal me' + end + assert_equal old_stdout_position, STDOUT.tell + assert_equal old_stderr_position, STDERR.tell + rescue Errno::ESPIPE + # Skip if we can't STDERR.tell + end + def test_silence_stderr_with_return_value assert_equal 1, silence_stderr { 1 } end |