From b912be05cbc0fd6a402411e01f0b7f90fcfbe2ba Mon Sep 17 00:00:00 2001 From: Marie Leuliette Date: Thu, 31 Oct 2024 16:33:42 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Mets=20=C3=A0=20jour=20les=20champs?= =?UTF-8?q?=20sp=C3=A9cifiques=20d'une=20question=20gclic=20dans=20image?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/import_question.rb | 2 ++ spec/models/import_question_spec.rb | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/models/import_question.rb b/app/models/import_question.rb index 974994240..881ab5d35 100644 --- a/app/models/import_question.rb +++ b/app/models/import_question.rb @@ -157,6 +157,8 @@ def cree_reponse(data) def telecharge_fichier(url) @current_download = url + return unless url + fichier = Down.download(url) content_type = Marcel::MimeType.for(fichier.path, name: fichier.original_filename) diff --git a/spec/models/import_question_spec.rb b/spec/models/import_question_spec.rb index f568c0605..51970b733 100644 --- a/spec/models/import_question_spec.rb +++ b/spec/models/import_question_spec.rb @@ -37,7 +37,7 @@ expect(question.nom_technique).to eq 'N1Pse5' expect(question.libelle).to eq 'N1Pse5' expect(question.description).to eq 'Ceci est une description' - # expect(question.illustration.attached?).to be true + expect(question.illustration.attached?).to be true end end @@ -119,4 +119,20 @@ expect(reponse2.illustration.attached?).to be true end end + + describe 'pour une question de type clic dans image' do + subject(:service) do + described_class.new('QuestionClicDansImage') + end + + let(:file) do + fixture_file_upload('spec/support/import_question_clic.xls', 'text/xls') + end + + it 'importe les données spécifiques' do + service.remplis_donnees(file) + question = Question.last + expect(question.image_au_clic.attached?).to eq true + end + end end