Ruby on Rails sometimes gives you annoying "Ignoring attempts to close x with y" warnings arising from assert_select. Often these warnings are the result of invalid HTML, but sometimes they appear even if the HTML is valid. The error in my case looks like this while running ruby test/functional/my_controller_test.rb
:
..ignoring attempt to close div with h2
opened at byte 8551, line 207
closed at byte 9554, line 243
attributes at open: {"class"=>"my_css_class", "id"=>"object_1"}
text around open: " \r\n \r\n \r\n \r\n\r\n <div class=\"my_css_class"
text around close: "</a>\r\n </h2>\r\n\r\n <span"
But there is no attempt to close a div with a h2 tag. I tried a HTML validator, but without success. The -W0 parameter mentioned by Giles seems to help - ruby -W0 test/functional/my_controller_test.rb
gives no longer a warning, but this does not work for rake test:whatever
. What does -W0 do, and how can you avoid using it?