Permalink
Browse files

Test Kernel#quietly

  • Loading branch information...
amatsuda committed Jan 22, 2013
1 parent 36ff09d commit ffd0dd31f8065903471895bf95ade061a488142b
Showing with 12 additions and 0 deletions.
  1. +12 −0 activesupport/test/core_ext/kernel_test.rb
@@ -38,6 +38,18 @@ def test_silence_stderr
# 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

0 comments on commit ffd0dd3

Please sign in to comment.