Created
July 7, 2010 05:54
-
-
Save eparreno/466358 to your computer and use it in GitHub Desktop.
RSpec ActionMailer test
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
# config/environments/test.rb | |
ActionMailer::Base.delivery_method = :test | |
# spec/models/mailer_spec.rb | |
describe Mailer do | |
before(:each) do | |
ActionMailer::Base.deliveries = [] | |
end | |
it 'should send some random email' do | |
mail = Mailer.deliver_some_random_email("name") | |
ActionMailer::Base.deliveries.size.should == 1 | |
mail.body.should =~ /name/ | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment