Skip to content

Instantly share code, notes, and snippets.

@eparreno
Created July 7, 2010 05:54
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eparreno/466358 to your computer and use it in GitHub Desktop.
Save eparreno/466358 to your computer and use it in GitHub Desktop.
RSpec ActionMailer test
# 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