File: assert_warning.rb

package info (click to toggle)
coderay 1.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 688 kB
  • ctags: 580
  • sloc: ruby: 7,559; makefile: 7
file content (15 lines) | stat: -rw-r--r-- 305 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Test::Unit::TestCase
  
  def assert_warning expected_warning
    require 'stringio'
    oldstderr = $stderr
    $stderr = StringIO.new
    yield
    $stderr.rewind
    given_warning = $stderr.read.chomp
    assert_equal expected_warning, given_warning
  ensure
    $stderr = oldstderr
  end
  
end