Created
December 27, 2013 12:38
-
-
Save linko/8146446 to your computer and use it in GitHub Desktop.
Mailer test example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe 'SomethingMailer' do | |
include Rails.application.routes.url_helpers | |
let(:something) { create :something } | |
describe 'accepted' do | |
let(:mail) { SomethingMailer.accepted(something) } | |
it 'renders the subject' do | |
mail.subject.should == 'Subject Accepted' | |
end | |
#ensure that the receiver is correct | |
it 'renders the receiver email' do | |
mail.to.should == [something.email] | |
end | |
#ensure that the sender is correct | |
it 'renders the sender email' do | |
mail.from.should == [AppConfig['something_mail']] | |
end | |
#ensure that the @name variable appears in the email body | |
it 'assigns {{name}}' do | |
mail.body.encoded.should match("Hello #{something.name}!") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment