The Ruby Accessibility Analysis Kit

Posted by Mike Blake Tue, 25 Jul 2006 14:33:00 GMT

Raakt

I was excited to see that Peter Krantz heard the call from the Rails Core team for education about accessibility issues and created Raakt(Ruby Accessibility Analysis Kit). I put it to use immediately, but ran into a strange problem.

The rubyfull_soup gem, which raakt requires contains a class named ‘Tag’, and so does the project I’m using to try out raakt. So I got this error in my functional tests.

ActionView::TemplateError: undefined method `keywords' for Tag:Class

The View is looking for a Model object named ‘Tag’, but it’s finding the rubyfull soup Tag object.

then I tried explicitly loading my Tag object first, and I got this error.

TypeError: superclass mismatch for class Tag

The best workaround I found was to require ‘raakt’ just prior to using it in the method.

  def assert_basic_accessibility
    require 'raakt'
    rt = Raakt::Test.new(@response.body)
    result = rt.all
    assert result.length == 0, result.collect { |msg| "\n" + msg.text + "\n" }
  end 

This little problem reinforces what I mention below . It’s best to put new classes inside modules to give them unique namespaces.

Anyway, Raakt is a great addition to Rails built in testing capabilities. I’m adding it to all my projects.

Posted in  | no comments

Comments

(leave url/email »)

   Preview comment