mailer: improve naming in specs

This commit is contained in:
Pierre de La Morinerie 2018-09-05 15:15:16 +02:00
parent 8ce2b4054a
commit d7dd027cb8

View file

@ -18,7 +18,7 @@ RSpec.describe NotificationMailer, type: :mailer do
describe '.send_notification' do
let(:email_template) { instance_double('email_template', subject_for_dossier: 'subject', body_for_dossier: 'body') }
subject do
subject(:mail) do
klass = Class.new(described_class) do
# Were testing the (private) method `NotificationMailer#send_notification`.
#
@ -32,13 +32,13 @@ RSpec.describe NotificationMailer, type: :mailer do
klass.send_notification(dossier, email_template)
end
it { expect(subject.subject).to eq(email_template.subject_for_dossier) }
it { expect(subject.body).to eq(email_template.body_for_dossier) }
it { expect(mail.subject).to eq(email_template.subject_for_dossier) }
it { expect(mail.body).to eq(email_template.body_for_dossier) }
it_behaves_like "create a commentaire not notified"
end
describe '.send_dossier_received' do
subject { described_class.send_dossier_received(dossier) }
subject(:mail) { described_class.send_dossier_received(dossier) }
let(:email_template) { create(:received_mail) }
before do
@ -46,8 +46,8 @@ RSpec.describe NotificationMailer, type: :mailer do
end
it do
expect(subject.subject).to eq(email_template.subject)
expect(subject.body).to eq(email_template.body)
expect(mail.subject).to eq(email_template.subject)
expect(mail.body).to eq(email_template.body)
end
it_behaves_like "create a commentaire not notified"