require "spec_helper" require "fileutils" RSpec.describe Metanorma::Iec do before(:all) do @boilerplate = boilerplate(Nokogiri::XML("#{BLANK_HDR}")) end it "generates reference boilerplate for IEV" do input = <<~INPUT = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :docnumber: 60050 [bibliography] == Normative References * [[[A,B]]], _TITLE_ INPUT output = <<~OUTPUT IEC 60050 ED 1 60050 International Electrotechnical Commission IEC International Electrotechnical Commission IEC en 60 60 #{Time.now.year} International Electrotechnical Commission IEC article vocabulary IEC 60050 International standard #{@boilerplate} Normative references

The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

TITLE B
OUTPUT expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end it "generates terms boilerplate for IEV" do input = <<~INPUT = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :docnumber: 60050 == Terms and definitions === General ==== Term 1 INPUT output = <<~OUTPUT IEC 60050 ED 1 60050 International Electrotechnical Commission IEC International Electrotechnical Commission IEC en 60 60 #{Time.now.year} International Electrotechnical Commission IEC article vocabulary IEC 60050 International standard #{@boilerplate} Terms and definitions General Term 1 OUTPUT expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end it "uses IEV introduction title" do input = <<~INPUT = Document title Author :docfile: test.adoc :nodoc: :novalid: :no-isobib: :docnumber: 60050 == Introduction Text INPUT output = <<~OUTPUT IEC 60050 ED 1 60050 International Electrotechnical Commission IEC International Electrotechnical Commission IEC en 60 60 #{Time.now.year} International Electrotechnical Commission IEC article vocabulary IEC 60050 International standard #{@boilerplate} INTRODUCTION<br/>Principles and rules followed

Text

OUTPUT expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS)))) .to be_equivalent_to xmlpp(output) end end