Skip to content

Commit

Permalink
✨ Mets à jour les champs spécifiques d'une question gclic dans image
Browse files Browse the repository at this point in the history
  • Loading branch information
marouria committed Oct 31, 2024
1 parent 0521e5d commit b912be0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/models/import_question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
18 changes: 17 additions & 1 deletion spec/models/import_question_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

0 comments on commit b912be0

Please sign in to comment.