demarches-normaliennes/spec/mailers/previews/avis_mailer_preview.rb
Martin cb890343ff feat(targeted_user_link): add targeted user link to wrap expert invitation in order to avoid access issue when the expert is connected with another account
feat(user.merge): ensure to merge user.targeted_user_link

Update app/models/targeted_user_link.rb

Co-authored-by: LeSim <mail@simon.lehericey.net>

Update app/models/targeted_user_link.rb

Co-authored-by: LeSim <mail@simon.lehericey.net>

Update app/models/targeted_user_link.rb

Co-authored-by: LeSim <mail@simon.lehericey.net>

feat(db/create_targeted_user_links): ensure not null with fk
2022-05-31 14:50:31 +02:00

12 lines
696 B
Ruby

# Preview all emails at http://localhost:3000/rails/mailers/avis_mailer
class AvisMailerPreview < ActionMailer::Preview
def avis_invitation
gestionaire = Instructeur.new(id: 1, user: User.new(email: 'jeanmichel.de-chauvigny@exemple.fr'))
avis = Avis.new(id: 1, email: 'test@exemple.fr', claimant: gestionaire)
targeted_link = TargetedUserLink.build(target_model: avis, user: avis.expert.user, target_context: :avis)
avis.dossier = Dossier.new(id: 1)
avis.dossier.procedure = Procedure.new(libelle: 'Démarche pour faire des marches')
avis.introduction = 'Il faudrait vérifier le certificat de conformité.'
AvisMailer.avis_invitation(avis, targeted_link)
end
end