you_are_invited_on_dossier -> avis_invitation
- shorter - clearer
This commit is contained in:
parent
8411a4d6bf
commit
2a74207d15
5 changed files with 6 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
class AvisMailer < ApplicationMailer
|
||||
|
||||
def you_are_invited_on_dossier(avis)
|
||||
def avis_invitation(avis)
|
||||
@avis = avis
|
||||
email = @avis.gestionnaire.try(:email) || @avis.email
|
||||
mail(to: email, subject: "Donnez votre avis sur le dossier nº #{@avis.dossier.id} (#{@avis.dossier.procedure.libelle})")
|
||||
|
|
|
@ -15,7 +15,7 @@ class Avis < ApplicationRecord
|
|||
end
|
||||
|
||||
def notify_gestionnaire
|
||||
AvisMailer.you_are_invited_on_dossier(self).deliver_now
|
||||
AvisMailer.avis_invitation(self).deliver_now
|
||||
end
|
||||
|
||||
def self.link_avis_to_gestionnaire(gestionnaire)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe AvisMailer, type: :mailer do
|
||||
describe '.you_are_invited_on_dossier' do
|
||||
describe '.avis_invitation' do
|
||||
let(:avis) { create(:avis) }
|
||||
|
||||
subject { described_class.you_are_invited_on_dossier(avis) }
|
||||
subject { described_class.avis_invitation(avis) }
|
||||
|
||||
it { expect(subject.subject).to eq("Donnez votre avis sur le dossier nº #{avis.dossier.id} (#{avis.dossier.procedure.libelle})") }
|
||||
it { expect(subject.body).to include("Vous avez été invité par #{avis.claimant.email} à donner votre avis sur le dossier nº #{avis.dossier.id} de la procédure : #{avis.dossier.procedure.libelle}.") }
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# Preview all emails at http://localhost:3000/rails/mailers/avis_mailer
|
||||
class AvisMailerPreview < ActionMailer::Preview
|
||||
|
||||
def you_are_invited_on_dossier
|
||||
AvisMailer.you_are_invited_on_dossier(Avis.last)
|
||||
def avis_invitation
|
||||
AvisMailer.avis_invitation(Avis.last)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue