demarches-normaliennes/spec/mailers/notification_mailer_spec.rb
gregoirenovel ba4ee68019 Use masculine ordinal indicator instead of the degree sign
It’s the right way to contract “numéro”

We should use the superscript lowercase o but
it’s hard to do in places where only raw text is
available
2017-04-19 11:19:53 +02:00

24 lines
1 KiB
Ruby

require "spec_helper"
RSpec.describe NotificationMailer, type: :mailer do
describe '.send_notification' do
let(:user) { create(:user) }
let(:dossier) { create(:dossier, user: user) }
let(:email) { instance_double('email', object_for_dossier: 'object', body_for_dossier: 'body') }
subject { described_class.send_notification(dossier, email) }
it { expect(subject.subject).to eq(email.object_for_dossier) }
it { expect(subject.body).to eq(email.body_for_dossier) }
end
describe ".new_answer" do
let(:user) { create(:user) }
let(:dossier) { create(:dossier, user: user) }
subject(:subject) { described_class.new_answer(dossier) }
it { expect(subject.body).to match('Un nouveau message est disponible dans votre espace TPS.') }
it { expect(subject.body).to include("Pour le consulter, merci de vous rendre sur #{users_dossier_recapitulatif_url(dossier_id: dossier.id)}") }
it { expect(subject.subject).to eq("Nouveau message pour votre dossier TPS Nº#{dossier.id}") }
end
end