Sha256: 5362f80c35d1f0a20688bfd408e398eaa34f76900de80994d37e26e2f1a9c08a
Contents?: true
Size: 927 Bytes
Versions: 11
Compression:
Stored size: 927 Bytes
Contents
require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart') require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb') class TestXmlSchema < Minitest::Test def test_xmlschema doc = XML::Smart.open(::File.dirname(__FILE__) + "/HELLO.xml") doc.xinclude! xsd = XML::Smart.open(::File.dirname(__FILE__) + "/HELLO.xsd") nums = 500 # Watch the power Minitest::PerformanceReporter::start_timing "XML Schema #validate_against (#{nums} times)" nums.times do doc.validate_against(xsd) end assert(doc.validate_against(xsd) == true) Minitest::PerformanceReporter::end_timing doc.find('/hellos/hello[3]').each do |h| h.qname.name = 'test' end assert(!doc.validate_against(xsd)) doc.validate_against(xsd) do |err| assert("#{err.file} line #{err.line}: #{err.to_s}" =~ /HELLO.xml .* Did not expect element test there/) end end end
Version data entries
11 entries across 11 versions & 1 rubygems