[rspec-users] w3 validation

Jonathan Linowes jonathan at parkerhill.com
Tue Sep 16 12:37:37 EDT 2008


On Sep 15, 2008, at 6:16 PM, 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.
>

fyi, this goes out to w3
	http://blogs.smarteguru.com/2008/09/rails-plugin-to-validate-xhtml- 
and-css/
	http://github.com/CodeMonkeySteve/assert-valid-asset/tree/master
but required i hack it to work with stories
(in file assert_valid_asset.rb#180, add line:
     method_name ||= 'story'

But also found this, which uses tidy and is significantly faster
	http://blog.cosinux.org/pages/rails-tidy
	http://www.cosinux.org/~dam/projects/rails-tidy/doc/

So
   Then "the browser page should be valid" do
     assert_tidy
   end



-- jonathan linowes
     parkerhill technology group llc
     jonathan at parkerhill.com
     office: 603-838-2884
     www.parkerhill.com
     blog: www.vaporbase.com




More information about the rspec-users mailing list