discourse/discourse — pull request #685 by mshappe (2013-04-10 03:42:48+00:00)
Title: Create and use new rspec matcher 'match_html'

This introduces match_html, which converts actual and expected HTML strings into "canonical" HTML using Nokogiri with NOBLANKS and COMPACT, and then does a simple equality comparison on the results of to_html on each.

This eliminates whitespace differences introduced by library changes (e.g. the libxml2 2.9.0 change).

pretty_text_spec.rb has been changed to use match_html where appropriate. and all tests pass under libxml2 2.7.6, 2.8.0 or 2.9.0

I don't necessarily consider this a "final" implementation, since it's a bit brute-force, but it seems to work quickly, and it seems to solve the issue in a way that should be fairly permissive of similar changes in the future.