From c215300500d49e695e1456bbe925252d225db5bb Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Sun, 29 Oct 2023 11:05:49 +0800 Subject: [PATCH] Add spec tests for chat block --- spec/chat_block_processor_spec.rb | 99 +++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 spec/chat_block_processor_spec.rb diff --git a/spec/chat_block_processor_spec.rb b/spec/chat_block_processor_spec.rb new file mode 100644 index 0000000..80f9864 --- /dev/null +++ b/spec/chat_block_processor_spec.rb @@ -0,0 +1,99 @@ +# frozen_string_literal: true + +describe ChatBlock do + it 'should create a basic chat block' do + input = <<~INPUT + [chat, foodogsquared] + ==== + Hello there! + ==== + INPUT + + expected = <<~RESULT +
+
+
+
+ foodogsquared +
+
+
+
+ foodogsquared +
+

Hello there!

+
+
+
+ RESULT + + actual = (Asciidoctor.convert input).tr_s '\n', '\n' + (expect actual).to eq expected.chomp + end + + it 'should create a basic chat block with non-default values with document attributes' do + input = <<~INPUT + :avatarsdir: /avatars + :avatarstype: webp + + [chat, foodogsquared] + ==== + Hello there! + ==== + INPUT + + expected = <<~RESULT +
+
+
+
+ foodogsquared +
+
+
+
+ foodogsquared +
+

Hello there!

+
+
+
+ RESULT + + actual = (Asciidoctor.convert input).tr_s '\n', '\n' + (expect actual).to eq expected.chomp + end + + it 'should create a basic chat block with non-default values' do + input = <<~INPUT + :avatarsdir: /avatars + :avatarstype: webp + + [chat, foodogsquared, state=nervous, role=shake] + ==== + Hello there! + ==== + INPUT + + expected = <<~RESULT +
+
+
+
+ foodogsquared +
+
+
+
+ foodogsquared +
+

Hello there!

+
+
+
+ RESULT + + actual = (Asciidoctor.convert input).tr_s '\n', '\n' + (expect actual).to eq expected.chomp + end +end