Nettoyage de I18n.transliterate pour les noms de feuilles d'exports

Co-authored-by: LeSim <mail@simon.lehericey.net>
This commit is contained in:
Keirua 2020-09-29 17:29:36 +02:00 committed by Keirua (Rebase PR Action)
parent 9714b607aa
commit 3fa628235e
2 changed files with 4 additions and 4 deletions

View file

@ -76,9 +76,9 @@ class ProcedureExportService
# transliterate: convert to ASCII characters # transliterate: convert to ASCII characters
# to ensure truncate respects 30 bytes # to ensure truncate respects 30 bytes
# /\*?[] are invalid Excel worksheet characters # /\*?[] are invalid Excel worksheet characters
options[:sheet_name] = I18n.transliterate( options[:sheet_name] = I18n.transliterate(options[:sheet_name], '', locale: :en)
ActiveStorage::Filename.new(options[:sheet_name].delete('[]*?')).sanitized, '', locale: :en .delete('/\*?[]')
).truncate(30, omission: '') .truncate(30, omission: '')
options options
end end

View file

@ -359,7 +359,7 @@ describe ProcedureExportService do
context 'with long libelle composed of utf8 characteres' do context 'with long libelle composed of utf8 characteres' do
before do before do
procedure.types_de_champ.each do |c| procedure.types_de_champ.each do |c|
c.update!(libelle: "#{c.id} - éééé ééé ééé ééééééé ???? ééééééé éééééééé. ééé éé éééééééé éé ééé. ééééé éééééééé ééé ééé.") c.update!(libelle: "#{c.id} - ?/[] ééé ééé ééééééé ééééééé éééééééé. ééé éé éééééééé éé ééé. ééééé éééééééé ééé ééé.")
end end
champ_repetition.champs.each do |c| champ_repetition.champs.each do |c|
c.type_de_champ.update!(libelle: "#{c.id} - Quam rem nam maiores numquam dolorem nesciunt. Cum et possimus et aut. Fugit voluptas qui qui.") c.type_de_champ.update!(libelle: "#{c.id} - Quam rem nam maiores numquam dolorem nesciunt. Cum et possimus et aut. Fugit voluptas qui qui.")