Suppressing warnings in Ruby (in my case, assert_select)

assert_select outputs warnings to stderr about invalid HTML problems (something like a mismatching closing

), yet the assertion still passes/fails as expected. So, instead of fixing the real problem by digging through our layout and partials rhtmls and find the mismatching

, I just want to suppress the warnings. :)
From http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/210670

def quietly
v = $VERBOSE
$VERBOSE = nil
yield
ensure
$VERBOSE = v
end
then, in my case
quietly{ assert_select “h1″ }
discussion by DISQUS
Add New Comment