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 »