Sha256: 8c5a12699ba4b4c23bd5b68e8554523f46c75d1e67042788cecdd76cc08ac813
Contents?: true
Size: 1.42 KB
Versions: 37
Compression:
Stored size: 1.42 KB
Contents
require File.dirname(__FILE__) + '/helper' require File.dirname(__FILE__) + '/fixtures/mailer_app/app' class TestPadrinoMailer < Test::Unit::TestCase def app MailerDemo.tap { |app| app.set :environment, :test } end context 'for mail delivery in sample application' do setup { Padrino::Mailer::Base::views_path = MailerDemo.views MailerDemo::SampleMailer.smtp_settings = MailerDemo.smtp_settings } should 'be able to deliver plain text emails' do assert_email_sent(:to => 'john@fake.com', :from => 'noreply@birthday.com', :via => :smtp, :subject => "Happy Birthday!", :body => "Happy Birthday Joey! \nYou are turning 21") visit '/deliver/plain', :post assert_equal 'mail delivered', last_response.body end should 'be able to deliver html emails' do assert_email_sent(:to => 'julie@fake.com', :from => 'noreply@anniversary.com', :type => 'html', :via => :smtp, :subject => "Happy anniversary!", :body => "<p>Yay Joey & Charlotte!</p>\n<p>You have been married 16 years</p>") visit '/deliver/html', :post assert_equal 'mail delivered', last_response.body end end protected def assert_email_sent(mail_attributes) delivery_attributes = mail_attributes.merge(:smtp => MailerDemo.smtp_settings) Padrino::Mailer::MailObject.any_instance.expects(:send_mail).with(delivery_attributes).once.returns(true) end end
Version data entries
37 entries across 37 versions & 1 rubygems