Jandaweb

assert_valid_xhtml - now with RSpec matcher!

By Andrew Bruce on Sunday 29th June 5:24 PM

RSpec matcher for assert_valid_xhtml


script/plugin install git://www.jandaweb.com/assert_valid_xhtml

Then add config.include ValidateXhtml to your spec/spec_helper.rb

Now you're ready to do


it "should be valid" do
  render "/some/template"
  response.should be_valid_xhtml
end


Fudge warning

The matcher will not validate your view with its full layout, as I haven't worked out how to get views to render with a layout from a view test. Instead, it wraps a valid XHTML header / footer around the rendered template.

Let me know if you can do this better!

« Back to list