Test for valid markup in functional tests

Here’s a way to assert_valid_markup in Rails. I don’t know if it’s old news or not, but it’s new to me. I always test my markup in the W3C validator after it’s live. I’ve never looked into any other solution, so I think I’ll find this useful. Anyone know how to test for valid markup (locally) other than this?

Comments

01

Chris on Fri Apr 20 at 09:27AM

Interesting. However, I have to confess – I haven’t been concerned with valid markup for a long time. I think I just assume I’m writing perfect code :-p

02

Nick on Fri Apr 20 at 09:42AM

I praise valid markup. Such a shame that my site doesn’t validate at the moment. :-p

03

Ryan on Fri Apr 20 at 12:43PM

Chris—You probably do write perfect code, but you’re the exception. The rest of us have to check. Didn’t you even write your own validator at some point?

I don’t know what it is about valid markup, but I usually always try to comply with it (to an extent). Always on my own site, but my eagerness dies down on applications that exist mostly behind a login.

Have something to say?
Please rewrite the image text Are You Human? Hint: Are You Human? Formatting Tips

or

© 2009 Ryan Heath | Site Management A Ruby on Rails production.

Get in Touch