[rspec-users] w3 validation

Matt Wynne matt at mattwynne.net
Tue Sep 16 02:52:40 EDT 2008


On 15 Sep 2008, at 23:16, Zach Dennis wrote:

> On Mon, Sep 15, 2008 at 5:32 PM, Jonathan Linowes
> <jonathan at parkerhill.com> wrote:
>> Hi,
>> suggestions how to add w3 validation to a story step?
>> eg
>> Then the page should be valid
>>
>
> You could write a "then" step that takes the current response.body,
> uploads it to the w3 validator, and checks the the response. Rather
> than uploading you could use the ruby tidy bindings to do offline
> validation which would most likely be much faster. See
> http://tidy.rubyforge.org/ for more information.

I'd love to see such a thing if you did make it.

The other day, I got around this issue (I forgot to close a tag  
somewhere and the page didn't render in safari) by writing a matcher  
be_valid_xml() which just tried to load the response.body into an XML  
document. That was enough to catch my bug, but this would be a great  
tool to have in the box.

cheers,
Matt
----
http://blog.mattwynne.net
http://songkick.com

In case you wondered: The opinions expressed in this email are my own  
and do not necessarily reflect the views of any former, current or  
future employers of mine.





More information about the rspec-users mailing list