Sha256: ec4c688f9728e4166441fd55b1293b0a2b80d4c2d35502be68b326137c7dd24c

Contents?: true

Size: 1.38 KB

Versions: 22

Compression:

Stored size: 1.38 KB

Contents

require "spec_helper"
require "fileutils"

RSpec.describe Metanorma::Iec do
  context "when xref_error.adoc compilation" do
    around do |example|
      FileUtils.rm_f "spec/assets/xref_error.err"
      example.run
      Dir["spec/assets/xref_error*"].each do |file|
        next if file.match?(/adoc$/)

        FileUtils.rm_f(file)
      end
    end

    it "generates error file" do
      expect do
        mock_pdf
        Metanorma::Compile
          .new
          .compile("spec/assets/xref_error.adoc", type: "iec", no_install_fonts: true)
      end.to(change { File.exist?("spec/assets/xref_error.err") }
              .from(false).to(true))
    end
  end

  it "Warns of illegal doctype" do
    FileUtils.rm_f "test.err"
    Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)
      = Document title
      Author
      :docfile: test.adoc
      :nodoc:
      :no-isobib:
      :doctype: pizza

      text
    INPUT
    expect(File.read("test.err")).to include "pizza is not a recognised document type"
  end

  it "Warns of illegal function" do
    FileUtils.rm_f "test.err"
    Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)
      = Document title
      Author
      :docfile: test.adoc
      :nodoc:
      :no-isobib:
      :function: pizza

      text
    INPUT
    expect(File.read("test.err")).to include "pizza is not a recognised document function"
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
metanorma-iec-2.1.11 spec/metanorma/validate_spec.rb
metanorma-iec-2.1.10 spec/metanorma/validate_spec.rb
metanorma-iec-2.1.9 spec/metanorma/validate_spec.rb
metanorma-iec-2.1.8.1 spec/metanorma/validate_spec.rb
metanorma-iec-2.1.8 spec/metanorma/validate_spec.rb
metanorma-iec-2.1.7 spec/metanorma/validate_spec.rb
metanorma-iec-2.1.6 spec/metanorma/validate_spec.rb
metanorma-iec-2.1.5 spec/metanorma/validate_spec.rb
metanorma-iec-2.1.4 spec/metanorma/validate_spec.rb
metanorma-iec-2.1.3 spec/metanorma/validate_spec.rb
metanorma-iec-2.1.2 spec/metanorma/validate_spec.rb
metanorma-iec-2.1.1 spec/metanorma/validate_spec.rb
metanorma-iec-2.1.0 spec/metanorma/validate_spec.rb
metanorma-iec-2.0.8 spec/metanorma/validate_spec.rb
metanorma-iec-2.0.7 spec/metanorma/validate_spec.rb
metanorma-iec-2.0.6 spec/metanorma/validate_spec.rb
metanorma-iec-2.0.5 spec/metanorma/validate_spec.rb
metanorma-iec-2.0.4 spec/metanorma/validate_spec.rb
metanorma-iec-2.0.3 spec/metanorma/validate_spec.rb
metanorma-iec-2.0.2 spec/metanorma/validate_spec.rb