require "spec_helper" require "nokogiri" RSpec.describe IsoDoc::Iso::Metadata do it "processes IsoXML metadata" do c = IsoDoc::Iso::HtmlConvert.new({}) arr = c.convert_init(<<~"INPUT", "test", false) INPUT expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT" Cereals and pulses Specifications and test methods Rice Céréales et légumineuses Spécification et méthodes d'essai Riz ISO/PreCD3 17301-1 17301 2011 2012 20102011 2013 2014 2 2016-05-01 0.4 ISO ISO en 30 92 3 2016 ISO international-standard Food products Cereals and pulses Rice Group GB ISO/PreCD3 17301 INPUT {:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>[], :authors_affiliations=>{}, :createddate=>"2010–2011", :docnumber=>"ISO/PreCD3 17301-1", :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1: Riz", :docsubtitleintro=>"Céréales et légumineuses", :docsubtitlemain=>"Spécification et méthodes d'essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie 1", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part 1", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :edition=>"2", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :ics=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :revdate=>"2016-05-01", :sc=>"SC 4", :secretariat=>"GB", :stage=>"30", :stage_int=>30, :stageabbr=>"PreCD3", :tc=>"TC 34", :tc_docnumber=>"17301", :unpublished=>true, :wg=>"WG 3"} OUTPUT end it "processes IsoXML metadata" do c = IsoDoc::Iso::HtmlConvert.new({}) arr = c.convert_init(<<~"INPUT", "test", false) INPUT expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT" <title type="title-intro" language="en" format="text/plain">Cereals and pulses Specifications and test methods Rice <title type="title-intro" language="fr" format="text/plain">Céréales et légumineuses Spécification et méthodes d'essai Riz ISO/IEC/CD 17301-1-3 17301 ISO ISO IEC en 60 92 2016 International Organization for Standardization 3.1 IEC 8121 international-standard Food products Cereals and pulses Rice Group 1.2.3 1.2.3 ISO/IEC/CD 17301 INPUT {:agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :docnumber=>"ISO/IEC/CD 17301-1-3", :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1–3: Riz", :docsubtitleintro=>"Céréales et légumineuses", :docsubtitlemain=>"Spécification et méthodes d'essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie 1–3", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1–3: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part 1–3", :doctype=>"International Standard", :docyear=>"2016", :draft=>nil, :draftinfo=>"", :edition=>nil, :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :revdate=>nil, :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"60", :stage_int=>60, :stageabbr=>"IS", :tc=>"ABC 34", :tc_docnumber=>"17301", :unpublished=>false, :wg=>"GHI 3"} OUTPUT end end