DEV: prevents flakey spec with dots (#23843)

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.
This commit is contained in:
Joffrey JAFFEUX 2023-10-09 12:23:48 +02:00 committed by GitHub
parent 81de02525f
commit cae282029e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,7 +63,7 @@ end
Fabricator(:chat_message_without_service, class_name: "Chat::Message") do Fabricator(:chat_message_without_service, class_name: "Chat::Message") do
user user
chat_channel 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_build { |message, attrs| message.cook }
after_create { |message, attrs| message.create_mentions } after_create { |message, attrs| message.create_mentions }
@ -89,7 +89,8 @@ Fabricator(:chat_message_with_service, class_name: "Chat::CreateMessage") do
resolved_class.call( resolved_class.call(
chat_channel_id: channel.id, chat_channel_id: channel.id,
guardian: user.guardian, 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, thread_id: transients[:thread]&.id,
in_reply_to_id: transients[:in_reply_to]&.id, in_reply_to_id: transients[:in_reply_to]&.id,
upload_ids: transients[:upload_ids], upload_ids: transients[:upload_ids],