Sha256: 25c1ac7cae991a13a10ebbf433f926e72e95000152664fe777c4c9eb9e27040b
Contents?: true
Size: 1.19 KB
Versions: 5
Compression:
Stored size: 1.19 KB
Contents
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path('..', __dir__) require 'cxml-ruby' require 'pry' Dir['./spec/support/**/*.rb'].sort.each { |f| require f } RSpec.configure do |config| config.expect_with(:rspec) { |c| c.syntax = :should } config.default_formatter = 'doc' if config.files_to_run.one? end def fixture_path(filename = nil) path = File.expand_path('fixtures', __dir__) filename.nil? ? path : File.join(path, filename) end def fixture(file) File.read(File.join(fixture_path, file)) end def dtd_path_from_url(url) return 'spec/fixtures/1.2.037-cXML.dtd' unless url match = url.match(%r{/(\d+\.\d+\.\d+)/(\w+\.dtd)}).to_a file = "spec/fixtures/#{match.last(2).join('-')}" return file if File.exist?(file) system("curl #{url} -O && mv #{match.last} #{file}") file end def test_for_xmllint return true if system('type xmllint > /dev/null 2>&1') puts 'skipping DTD validation without xmllint' false end def lint_doc_with_dtd(doc) file = "spec/output/#{rand}.xml" File.open(file, 'w') { |f| f.puts doc.to_xml } linted = system("xmllint --noout --dtdvalid #{dtd_path_from_url(doc.dtd_url)} #{file}") File.delete(file) if File.exist?(file) linted end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
cxml-ruby-0.8.2 | spec/spec_helper.rb |
cxml-ruby-0.8.1 | spec/spec_helper.rb |
cxml-ruby-0.8.0 | spec/spec_helper.rb |
cxml-ruby-0.7.0 | spec/spec_helper.rb |
cxml-ruby-0.6.1 | spec/spec_helper.rb |