spec/spec_helper.rb in isodoc-1.0.6 vs spec/spec_helper.rb in isodoc-1.0.7
- old
+ new
@@ -5,10 +5,11 @@
require "bundler/setup"
require "isodoc"
require "rspec/matchers"
require "equivalent-xml"
+require "rexml/document"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
@@ -16,9 +17,17 @@
config.disable_monkey_patching!
config.expect_with :rspec do |c|
c.syntax = :expect
end
+end
+
+def xmlpp(x)
+ s = ""
+ f = REXML::Formatters::Pretty.new(2)
+ f.compact = true
+ f.write(REXML::Document.new(x),s)
+ s
end
def strip_guid(x)
x.gsub(%r{ id="_[^"]+"}, ' id="_"').gsub(%r{ target="_[^"]+"}, ' target="_"').
gsub(%r( href="#[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{13}"), ' href="#_"').