require "spec_helper" require "nokogiri" RSpec.describe IsoDoc do it "processes IsoXML metadata" do c = IsoDoc::Convert.new({}) arr = c.convert_init(<<~"INPUT", "test", false) INPUT expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT" The Incredible Mr Ripley Cereals and pulses URL A URL B URL C URL D URL E 17301-1 17301 2011 2012 20102011 2013 2014 2015 2016 2017 2018 2019 2020 2 2016-05-01 0.4 ISO ISO Barney Rubble Slate Inc.
Bedrock
Fred Flintstone en Committee Draft Withdrawn 2 2016 ISO international-standard
INPUT {:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>["Barney Rubble", "Fred Flintstone"], :authors_affiliations=>{"Slate Inc., Bedrock"=>["Barney Rubble"], ""=>["Fred Flintstone"]}, :circulateddate=>"2015", :confirmeddate=>"2017", :copieddate=>"2016", :createddate=>"2010–2011", :doc=>"URL E", :docnumber=>"17301-1", :docnumeric=>"17301", :doctitle=>"Cereals and pulses", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :edition=>"2", :html=>"URL B", :implementeddate=>"XXX", :issueddate=>"XXX", :iteration=>"2", :obsoleteddate=>"2014", :pdf=>"URL D", :publisheddate=>"2011", :receiveddate=>"XXX", :revdate=>"2016-05-01", :stage=>"Committee draft", :stageabbr=>"CD", :substage=>"Withdrawn", :transmitteddate=>"2020", :unchangeddate=>"2019", :unpublished=>true, :updateddate=>"2018", :url=>"URL A", :xml=>"URL C"} OUTPUT end it "processes IsoXML metadata" do c = IsoDoc::Convert.new({}) arr = c.convert_init(<<~"INPUT", "test", false) INPUT expect(Hash[c.info(Nokogiri::XML(<<~"INPUT"), nil).sort]).to be_equivalent_to <<~"OUTPUT" Céréales et légumineuses</ti> <title language="en" format="text/plain">Cereals and pulses 17301-1-3 17301 ISO ISO IEC en Published 2016 International Organization for Standardization 3.1 IEC 8121 IEC 8122 international-standard 2016-05-01 12 INPUT {:accesseddate=>"XXX", :agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :circulateddate=>"XXX", :confirmeddate=>"XXX", :copieddate=>"XXX", :createddate=>"XXX", :docnumber=>"17301-1-3", :docnumeric=>"17301", :doctitle=>"Cereals and pulses", :doctype=>"International Standard", :docyear=>"2016", :draft=>"12", :draftinfo=>" (draft 12, 2016-05-01)", :edition=>nil, :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :partof=>"IEC 8122", :publisheddate=>"XXX", :receiveddate=>"XXX", :revdate=>"2016-05-01", :stage=>"Published", :transmitteddate=>"XXX", :unchangeddate=>"XXX", :unpublished=>false, :updateddate=>"XXX"} OUTPUT end end