Validate (X)HTML and CSS in Rails functional tests

With a handy plugin, you can validate (X)HTML and CSS in your functional tests. Unfortunately, the plugin broke in Rails 2.3.x. Here's how to fix it. Jan Bromberger am 24. Dezember 2009

With a handy plugin written by Peter Donald, you can validate (X)HTML and CSS in your Rails functional tests.The plugin requires the XmlSimple gem. Make sure to install it:

sudo gem install xml-simple

Then, in your functional tests, you can write:

test "valid markup" do
  get :index
  assert_valid_markup
end

Unfortunately, the plugin broke somewhere around Rails 2.3.x, but I figured out how to fix it pretty fast. Here’s what made it work for me. Continue reading »