Using Raakt in Ruby on Rails

Using Raakt in Ruby on Rails is easily done by adding a custom assertion method to the Test::Unit::TestCase class. Open the file test_helper.rb in the test folder in your Rails application. Add the following method to the class Test::Unit::TestCase:

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

Now you can test all views that render a complete HTML document by calling assert_basic_accessibiliy in your functional tests.