2017-05-02 15:37:06 +02:00
require " rails_helper "
RSpec . describe AvisMailer , type : :mailer do
2017-06-07 18:18:24 +02:00
describe '.avis_invitation' do
2017-05-02 15:37:06 +02:00
let ( :avis ) { create ( :avis ) }
2017-06-07 18:18:24 +02:00
subject { described_class . avis_invitation ( avis ) }
2017-05-02 15:37:06 +02:00
it { expect ( subject . subject ) . to eq ( " Donnez votre avis sur le dossier nº #{ avis . dossier . id } ( #{ avis . dossier . procedure . libelle } ) " ) }
2018-05-31 16:35:56 +02:00
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 } ". " ) }
2017-05-02 15:37:06 +02:00
it { expect ( subject . body ) . to include ( avis . introduction ) }
2018-08-08 13:19:23 +02:00
it { expect ( subject . body ) . to include ( gestionnaire_avis_url ( avis ) ) }
context 'when the recipient is not already registered' do
before do
avis . email = 'accompagnateur@email.com'
avis . gestionnaire = nil
end
it { expect ( subject . body ) . to include ( sign_up_gestionnaire_avis_url ( avis . id , avis . email ) ) }
end
2017-05-02 15:37:06 +02:00
end
end