spec/omml2mathml_spec.rb in omml2mathml-0.0.8 vs spec/omml2mathml_spec.rb in omml2mathml-0.0.9

- old
+ new

@@ -1,15 +1,16 @@ require "spec_helper" +require "nokogiri" RSpec.describe Omml2Mathml do it "has a version number" do expect(Omml2Mathml::VERSION).not_to be nil end it "processes a document" do - html = Omml2Mathml.convert("spec/test.html").sub(/<\?xml[^>]+>/, "").sub(/<!DOCTYPE[^>]+>/, "") - expect(html).to be_equivalent_to <<~"OUTPUT" + output = Omml2Mathml.convert("spec/test.html").sub(/<\?xml[^>]+>/, "").sub(/<!DOCTYPE[^>]+>/, "") + html = <<~"OUTPUT" <html xmlns="http://www.w3.org/TR/REC-html40" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="ProgId" content="Word.Document"/> @@ -55,7 +56,16 @@ </div> </body> </html> OUTPUT + + if Gem::Version.new(Nokogiri::VERSION) < Gem::Version.new("1.11") + output.gsub!("\n<mml:mo>&gt;</mml:mo>", "") + output.gsub!("http://www.w3.org/TR/REC-html40", "http://www.w3.org/1999/xhtml") + else + output.gsub!(%r{ xml:lang="[\w-]+"}, "") + end + + expect(html).to be_equivalent_to output end end