mirror of
https://github.com/foo-dogsquared/asciidoctor-foodogsquared-extensions.git
synced 2025-01-30 22:57:56 +00:00
Add spec tests for Wikipedia inline macro
This commit is contained in:
parent
e2ca9b57f1
commit
389abe4176
47
spec/wikipedia_inline_macro_spec.rb
Normal file
47
spec/wikipedia_inline_macro_spec.rb
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
describe WikipediaInlineMacro do
|
||||||
|
it 'should link to the Wikipedia page for Diff' do
|
||||||
|
input = 'wikipedia:Diff[]'
|
||||||
|
|
||||||
|
expected = <<~RESULT
|
||||||
|
<a href="https://en.wikipedia.org/wiki/Diff">Diff</a>
|
||||||
|
RESULT
|
||||||
|
|
||||||
|
actual = (Asciidoctor.convert input).tr_s '\n', '\n'
|
||||||
|
(expect actual).to include expected.chomp
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should link to the Japanese Wikipedia page for Diff' do
|
||||||
|
input = 'wikipedia:Diff[lang=ja]'
|
||||||
|
|
||||||
|
expected = <<~RESULT
|
||||||
|
<a href="https://ja.wikipedia.org/wiki/Diff">Diff</a>
|
||||||
|
RESULT
|
||||||
|
|
||||||
|
actual = (Asciidoctor.convert input).tr_s '\n', '\n'
|
||||||
|
(expect actual).to include expected.chomp
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should link to the Japanese Wikipedia page for Diff but with replaced captions' do
|
||||||
|
input = 'wikipedia:Diff[diff in Japanese Wikipedia, lang=ja]'
|
||||||
|
|
||||||
|
expected = <<~RESULT
|
||||||
|
<a href="https://ja.wikipedia.org/wiki/Diff">diff in Japanese Wikipedia</a>
|
||||||
|
RESULT
|
||||||
|
|
||||||
|
actual = (Asciidoctor.convert input).tr_s '\n', '\n'
|
||||||
|
(expect actual).to include expected.chomp
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should link to the Simple English Wikipedia page for photosynthesis' do
|
||||||
|
input = 'wikipedia:Photosynthesis[lang=simple]'
|
||||||
|
|
||||||
|
expected = <<~RESULT
|
||||||
|
<a href="https://simple.wikipedia.org/wiki/Photosynthesis">Photosynthesis</a>
|
||||||
|
RESULT
|
||||||
|
|
||||||
|
actual = (Asciidoctor.convert input).tr_s '\n', '\n'
|
||||||
|
(expect actual).to include expected.chomp
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user