# frozen_string_literal: true
describe ChatBlock do
it 'should create a basic chat block' do
input = <<~INPUT
[chat, foodogsquared]
====
Hello there!
====
INPUT
expected = <<~RESULT
RESULT
actual = (Asciidoctor.convert input).tr_s '\n', '\n'
(expect actual).to include 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
RESULT
actual = (Asciidoctor.convert input).tr_s '\n', '\n'
(expect actual).to include 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!
*wow*
====
INPUT
expected = <<~RESULT
RESULT
actual = (Asciidoctor.convert input).tr_s '\n', '\n'
(expect actual).to include expected.chomp
end
it 'should create a basic chat block with non-default values from the document' do
input = <<~INPUT
[chat, foodogsquared, state=nervous, role=shake]
====
Hello there!
*wow*
====
INPUT
expected = <<~RESULT
RESULT
attributes = { 'avatarstype' => 'hello', 'avatarsdir' => '/avatars' }
actual = (Asciidoctor.convert input, attributes: attributes).tr_s '\n', '\n'
(expect actual).to include expected.chomp
end
end