From 208491fa00282a8d6cf71d9515db9e2120b6ee4c Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Mon, 13 Nov 2023 14:54:26 +0100 Subject: [PATCH] DEV: uses alphanumeric to avoid flakey specs (#24344) Faker text with quotes or thread dots for example would cause issues in tests due to cooking. --- plugins/chat/spec/fabricators/chat_fabricator.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/chat/spec/fabricators/chat_fabricator.rb b/plugins/chat/spec/fabricators/chat_fabricator.rb index 3548100418f..2c3ba21f442 100644 --- a/plugins/chat/spec/fabricators/chat_fabricator.rb +++ b/plugins/chat/spec/fabricators/chat_fabricator.rb @@ -67,7 +67,7 @@ end Fabricator(:chat_message_without_service, class_name: "Chat::Message") do user chat_channel - message { Faker::Lorem.words(number: 5).join(" ") } + message { Faker::Alphanumeric.alpha(number: SiteSetting.chat_minimum_message_length) } after_build { |message, attrs| message.cook } after_create { |message, attrs| message.upsert_mentions } @@ -94,7 +94,9 @@ 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.words(number: 5).join(" "), + message: + transients[:message] || + Faker::Alphanumeric.alpha(number: SiteSetting.chat_minimum_message_length), thread_id: transients[:thread]&.id, in_reply_to_id: transients[:in_reply_to]&.id, upload_ids: transients[:upload_ids],