I have unit tests for several Rails helper methods that generate HTML.
For these I'm using this rather imperfect assert method

def assert_equal_ignoring_whitespace(expected, actual)
  assert_equal(clean_html(expected), clean_html(actual))
end

def clean_html(html)
  html.strip.gsub(/\s+/m, ' ').gsub(/>\s+</m, '><')
end

Semantics may be distorted as differences in significant whitespace can
be distorted. The advantage is that I can lay out the expected HTML
fragment in a legible fashion. I'd prefer to use a stricter check,
though.

Another issue is how the mismatch of actual and expected values is
displayed out of the box. For strings of several hundred characters of
length, it is not very helpful to have just the two strings. It would
be a whole lot nicer to have the differences emphasized.

Before I dig into the Test::Unit code myself, I hope that someone has
already put in the effort...

Michael

-- 
Michael Schuerig               Most people would rather die than think.
mailto:michael / schuerig.de                            In fact, they do.
http://www.schuerig.de/michael/                      --Bertrand Russell