mailer_preview: improve data used for generating previews

This commit is contained in:
Pierre de La Morinerie 2019-07-17 14:40:17 +02:00
parent 5bafda6619
commit 44574b2b93

View file

@ -1,7 +1,7 @@
# Preview all emails at http://localhost:3000/rails/mailers/dossier_mailer # Preview all emails at http://localhost:3000/rails/mailers/dossier_mailer
class DossierMailerPreview < ActionMailer::Preview class DossierMailerPreview < ActionMailer::Preview
def notify_new_draft def notify_new_draft
DossierMailer.notify_new_draft(dossier) DossierMailer.notify_new_draft(draft)
end end
def notify_new_answer def notify_new_answer
@ -26,11 +26,24 @@ class DossierMailerPreview < ActionMailer::Preview
DeletedDossier.new(dossier_id: 1, procedure: procedure) DeletedDossier.new(dossier_id: 1, procedure: procedure)
end end
def draft
Dossier.new(id: 47882, procedure: procedure, user: User.new(email: "usager@example.com"))
end
def dossier def dossier
Dossier.new(id: 1, procedure: procedure, user: User.new(email: "usager@example.com")) Dossier.new(id: 47882, state: :en_instruction, procedure: procedure, user: User.new(email: "usager@example.com"))
end end
def procedure def procedure
Procedure.new(libelle: 'Démarche pour des marches') Procedure.new(libelle: 'Dotation dÉquipement des Territoires Ruraux - Exercice 2019', service: service, logo: Rack::Test::UploadedFile.new("./spec/fixtures/files/logo_test_procedure.png", 'image/png'))
end
def service
Service.new(
nom: 'Direction du Territoire des Vosges',
email: 'prms@ddt.vosges.gouv.fr',
telephone: '01 34 22 33 85',
horaires: 'Du lundi au vendredi, de 9 h à 18 h'
)
end end
end end