One technique I picked up from [simply_agile] is to validate the HTML output by your views. That way, bad HTML isn’t introduced.
To start with, you need to install the [assert_valid_xhtml] plugin and the libxml-ruby gem.
In your [spec/spec_helper.rb] file, add the following inside the config block:
And at the end of the file, outside the config block, include the following:
describe "a standard view", :shared => true do it "should be successful" do response.should be_success end it "should be valid" do response.should be_valid_xhtml end end
Now in your view specs, include the following line:
it_should_behave_like "a standard view"
And that’s it. Now each view will be tested for valid xhtml when you run your specs.