Adapt the mailbot spec to the last changes

This commit is contained in:
Henne Vogelsang 2016-04-22 14:53:10 +02:00
parent 3391d09549
commit 20d908e085
2 changed files with 8 additions and 12 deletions

View file

@ -1,5 +1,4 @@
class Mailbot < ActionMailer::Base class Mailbot < ActionMailer::Base
def registration_mail(conference, user) def registration_mail(conference, user)
mail(to: user.email, mail(to: user.email,
from: conference.contact.email, from: conference.contact.email,

View file

@ -19,17 +19,20 @@ describe Mailbot do
it 'assigns the email receiver, sender, reply_to' do it 'assigns the email receiver, sender, reply_to' do
expect(mail.to).to eq ['user@example.com'] expect(mail.to).to eq ['user@example.com']
expect(mail.from).to eq ['conf@domain.com'] expect(mail.from).to eq ['conf@domain.com']
expect(mail.reply_to).to eq ['conf@domain.com']
end end
it 'assigns the email body' do it 'assigns the email body' do
expect(mail.body).to eq 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit' expect(mail.body).to eq 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit'
end end
it 'delivers the email' do
expect(ActionMailer::Base.deliveries).to include(mail)
end
end end
describe '.registration_mail' do describe '.registration_mail' do
include_examples 'mailer actions' do include_examples 'mailer actions' do
let(:mail) { Mailbot.registration_mail conference, user } let(:mail) { Mailbot.registration_mail(conference, user).deliver_now }
end end
end end
@ -41,7 +44,7 @@ describe Mailbot do
end end
include_examples 'mailer actions' do include_examples 'mailer actions' do
let(:mail) { Mailbot.acceptance_mail event } let(:mail) { Mailbot.acceptance_mail(event).deliver_now }
end end
end end
@ -53,7 +56,7 @@ describe Mailbot do
end end
include_examples 'mailer actions' do include_examples 'mailer actions' do
let(:mail) { Mailbot.rejection_mail event } let(:mail) { Mailbot.rejection_mail(event).deliver_now }
end end
end end
@ -65,13 +68,7 @@ describe Mailbot do
end end
include_examples 'mailer actions' do include_examples 'mailer actions' do
let(:mail) { Mailbot.confirm_reminder_mail event } let(:mail) { Mailbot.confirm_reminder_mail(event).deliver_now }
end
end
describe '.build_email' do
include_examples 'mailer actions' do
let(:mail) { Mailbot.build_email conference, 'user@example.com', 'Lorem Ipsum Dolsum', 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit' }
end end
end end
end end