require "spec_helper"
require "nokogiri"
RSpec.describe IsoDoc do
it "processes IsoXML metadata" do
expect(Hash[IsoDoc::Convert.new({}).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
17301
17301
2011
2012
20102011
2013
2014
ISO
ISO
en
30
92
3
2016
ISO
Food products
Cereals and pulses
Rice Group
GB
2
2016-05-01
0.4
INPUT
{:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :confirmeddate=>"XXX", :createddate=>"2010–2011", :docnumber=>"PreCD3 17301-1", :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1: Riz", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" ( 0.4, 2016-05-01)", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :revdate=>"2016-05-01", :sc=>"SC 4", :secretariat=>"GB", :stage=>"30", :stageabbr=>"PreCD3", :tc=>"TC 34", :updateddate=>"XXX", :wg=>"WG 3"}
OUTPUT
end
it "processes IsoXML metadata" do
expect(Hash[IsoDoc::Convert.new({}).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
17301
17301
ISO
ISO
IEC
en
30
92
2016
International Organization for Standardization
3.1
IEC 8121
Food products
Cereals and pulses
Rice Group
2
2016-05-01
12
INPUT
{:accesseddate=>"XXX", :agency=>"ISO/IEC", :confirmeddate=>"XXX", :createddate=>"XXX", :docnumber=>"CD 17301-1-3", :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1–3: Riz", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1–3: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"12", :draftinfo=>" ( 12, 2016-05-01)", :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisheddate=>"XXX", :revdate=>"2016-05-01", :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"30", :stageabbr=>"CD", :tc=>"ABC 34", :updateddate=>"XXX", :wg=>"GHI 3"}
OUTPUT
end
end