mirror of
https://github.com/foo-dogsquared/asciidoctor-foodogsquared-extensions.git
synced 2025-01-30 22:57:56 +00:00
Gabriel Arazas
de9f3a0e9c
Also restructured how they're named in the filesystem and the class names as well.
38 lines
1.2 KiB
Ruby
38 lines
1.2 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
describe FlathubInlineMacro do
|
|
it 'should create a Flathub link to Icon Library app' do
|
|
input = 'flathub:org.gnome.design.IconLibrary[]'
|
|
|
|
expected = <<~RESULT
|
|
<a href="https://flathub.org/apps/org.gnome.design.IconLibrary">Icon Library</a>
|
|
RESULT
|
|
|
|
actual = (Asciidoctor.convert input).tr_s '\n', '\n'
|
|
(expect actual).to include expected.chomp
|
|
end
|
|
|
|
it 'should create a Flathub link to Icon Library with replaced caption' do
|
|
input = 'flathub:org.gnome.design.IconLibrary[GNOME Icon Library]'
|
|
|
|
expected = <<~RESULT
|
|
<a href="https://flathub.org/apps/org.gnome.design.IconLibrary">GNOME Icon Library</a>
|
|
RESULT
|
|
|
|
actual = (Asciidoctor.convert input).tr_s '\n', '\n'
|
|
(expect actual).to include expected.chomp
|
|
end
|
|
|
|
it 'should fail to create a link to Flathub due to non-existent app' do
|
|
input = 'flathub:example.com.SomeNonexistentApp[]'
|
|
|
|
expect { Asciidoctor.convert input }.to raise_error StandardError
|
|
end
|
|
|
|
it 'should still fail to link with replaced caption to a non-existent app in Flathub' do
|
|
input = 'flathub:example.com.SomeNonexistentApp[replacing the caption]'
|
|
|
|
expect { Asciidoctor.convert input }.to raise_error StandardError
|
|
end
|
|
end
|