asciidoctor-foodogsquared-e.../spec/flathub_link_inline_macro_spec.rb
Gabriel Arazas de9f3a0e9c
Restructure extensions with Ruby modules
Also restructured how they're named in the filesystem and the class
names as well.
2023-11-06 22:54:57 +08:00

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