From 389abe4176f55459818929db6666fbb0453f2059 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Sun, 29 Oct 2023 17:27:00 +0800 Subject: [PATCH] Add spec tests for Wikipedia inline macro --- spec/wikipedia_inline_macro_spec.rb | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 spec/wikipedia_inline_macro_spec.rb diff --git a/spec/wikipedia_inline_macro_spec.rb b/spec/wikipedia_inline_macro_spec.rb new file mode 100644 index 0000000..0af290a --- /dev/null +++ b/spec/wikipedia_inline_macro_spec.rb @@ -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 + Diff + 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 + Diff + 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 + diff in Japanese Wikipedia + 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 + Photosynthesis + RESULT + + actual = (Asciidoctor.convert input).tr_s '\n', '\n' + (expect actual).to include expected.chomp + end +end