From cae282029eaeed5adef5bb75da8f38606f71771b Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Mon, 9 Oct 2023 12:23:48 +0200 Subject: [PATCH] DEV: prevents flakey spec with dots (#23843) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Faker can generate test containing `...` which will get converted to `…` by `PrettyText`, it means that we can't use the input to check the output. This commit simply normalise the generated text to ensure this part of the input is not modified. --- plugins/chat/spec/fabricators/chat_fabricator.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/chat/spec/fabricators/chat_fabricator.rb b/plugins/chat/spec/fabricators/chat_fabricator.rb index 802410e53d2..59b7c3bac86 100644 --- a/plugins/chat/spec/fabricators/chat_fabricator.rb +++ b/plugins/chat/spec/fabricators/chat_fabricator.rb @@ -63,7 +63,7 @@ end Fabricator(:chat_message_without_service, class_name: "Chat::Message") do user chat_channel - message { Faker::Lorem.paragraph_by_chars(number: 500) } + message { Faker::Lorem.paragraph_by_chars(number: 500).gsub("...", "…") } after_build { |message, attrs| message.cook } after_create { |message, attrs| message.create_mentions } @@ -89,7 +89,8 @@ Fabricator(:chat_message_with_service, class_name: "Chat::CreateMessage") do resolved_class.call( chat_channel_id: channel.id, guardian: user.guardian, - message: transients[:message] || Faker::Lorem.paragraph_by_chars(number: 500), + message: + transients[:message] || Faker::Lorem.paragraph_by_chars(number: 500).gsub("...", "…"), thread_id: transients[:thread]&.id, in_reply_to_id: transients[:in_reply_to]&.id, upload_ids: transients[:upload_ids],