Today's SCRUM call was pretty useful. Of course, it usually is. If nothing else it gives me a 'view' into the other work going on with the project.
Anyway, back to today...
Today my co-worker pointed out that he did not believe I had to go to http://validator.w3.org in order to determine if a particular view had valid xhtml markup.
He thought that by using rspec's have_tag that it would not only assert the existence of a particular tag but also that the markup is valid.
Plus we would have the added benefit of capturing this as a reproducible test for regression purposes.
However, I found that rspec's have_tag may be good at proving you have valid XML but does not go so far as validate the html against its spec.
For that I still need to turn to http://validator.w3.org.
A google search on the subject provided me with a hit to this blog where the author had created a custom rspec matcher that will take the response and make an http request to w3.org to assert validity!
Pretty cool!
Note: I'm not prepared to commit this to the project but it will prove more handy than manually uploading a file to check validity.
Update: I'm using the code from this pastie (provided as a comment to the original blog post) and making sure that the #validity_checks_disabled? method returns false.
About Me
- Kevin Compton
- Entreprenuer and professional software developer. Husband, Father and Friend.
Tuesday, December 9, 2008
Subscribe to:
Post Comments (Atom)
1 comments:
RSpec's have_tag will assert well-formedness, but it will not assert XHTML validity.
Post a Comment