Simplify finding warnings for assert_warning

also fixes a weird issue in Ruby 1.8.7 where duplicate
warnings were getting reported when there weren't any