spec/spec_helper.rb in isodoc-2.1.0.2 vs spec/spec_helper.rb in isodoc-2.1.1
- old
+ new
@@ -20,18 +20,25 @@
c.syntax = :expect
end
end
def xmlpp(xml)
+ c = HTMLEntities.new
+ xml &&= xml.split(/(&\S+?;)/).map do |n|
+ if /^&\S+?;$/.match?(n)
+ c.encode(c.decode(n), :hexadecimal)
+ else n
+ end
+ end.join
s = ""
f = REXML::Formatters::Pretty.new(2)
f.compact = true
f.write(REXML::Document.new(xml), s)
s
end
def metadata(hash)
- Hash[hash.sort].delete_if do |_k, v|
+ hash.sort.to_h.delete_if do |_k, v|
v.nil? || (v.respond_to?(:empty?) && v.empty?)
end
end
def strip_guid(xml)