Module: Test::Unit::Assertions
- Defined in:
- lib/html-validator.rb
Instance Method Summary collapse
Instance Method Details
#assert_is_xhtml_trans_valid(page) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/html-validator.rb', line 6 def assert_is_xhtml_trans_valid(page) schema_path = File.join(File.dirname(__FILE__), '..', 'schemas', 'xhtml1-transitional.xsd') schema = Nokogiri::XML::Schema(open(schema_path)) errors = schema.validate(Nokogiri::XML(page)) if errors.any? = "#{errors.count} errors:\n" errors.each{|error| << "#{error}\n"} raise AssertionFailedError.new() end end |