require "spec_helper" RSpec.describe Asciidoctor::ISO do it "processes the Asciidoctor::ISO inline macros" do expect(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} alt:[term1] deprecated:[term1] domain:[term1] INPUT #{BLANK_HDR} term1 term1 term1 OUTPUT end it "processes the PlantUML macro" do expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} [plantuml] .... @startuml Alice -> Bob: Authentication Request Bob --> Alice: Authentication Response Alice -> Bob: Another authentication Request Alice <-- Bob: another authentication Response @enduml .... [plantuml] .... Alice -> Bob: Authentication Request Bob --> Alice: Authentication Response Alice -> Bob: Another authentication Request Alice <-- Bob: another authentication Response .... INPUT #{BLANK_HDR}
OUTPUT end it "processes the PlantUML macro with PlantUML disabled" do mock_plantuml_disabled expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{PlantUML not installed}).to_stderr #{ASCIIDOC_BLANK_HDR} [plantuml] .... @startuml Alice -> Bob: Authentication Request Bob --> Alice: Authentication Response Alice -> Bob: Another authentication Request Alice <-- Bob: another authentication Response @enduml .... INPUT mock_plantuml_disabled expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT" #{ASCIIDOC_BLANK_HDR} [plantuml] .... @startuml Alice -> Bob: Authentication Request Bob --> Alice: Authentication Response Alice -> Bob: Another authentication Request Alice <-- Bob: another authentication Response @enduml .... INPUT #{BLANK_HDR} @startuml Alice -> Bob: Authentication Request Bob --> Alice: Authentication Response Alice -> Bob: Another authentication Request Alice <-- Bob: another authentication Response @enduml OUTPUT end private def mock_plantuml_disabled expect(Asciidoctor::Standoc::PlantUMLBlockMacroBackend).to receive(:plantuml_installed?) do false end end end