Sha256: 602970418335de641f48cd9cffe219248919426b8f444549f14af71c307de544

Contents?: true

Size: 1.15 KB

Versions: 12

Compression:

Stored size: 1.15 KB

Contents

require File.dirname(__FILE__) + '/helper'

class TestMailObject < Test::Unit::TestCase
  include Padrino::Mailer

  context 'for #deliver method' do
    should "send mail with attributes default to sendmail no smtp" do
      mail_object = Padrino::Mailer::MailObject.new(:to => "test@john.com", :from => "sender@sent.com", :body => "Hello")
      Delivery.expects(:mail).with(:to => "test@john.com", :from => "sender@sent.com", :body => "Hello", :via => :sendmail)
      mail_object.deliver
    end

    should "send mail with attributes default to smtp if set" do
      mail_object = Padrino::Mailer::MailObject.new({:to => "test@john.com", :body => "Hello"}, { :host => 'smtp.gmail.com' })
      Delivery.expects(:mail).with(:to => "test@john.com", :body => "Hello", :via => :smtp, :smtp => { :host => 'smtp.gmail.com' })
      mail_object.deliver
    end

    should "send mail with attributes use sendmail if explicit" do
      mail_object = Padrino::Mailer::MailObject.new({:to => "test@john.com", :via => :sendmail }, { :host => 'smtp.gmail.com' })
      Delivery.expects(:mail).with(:to => "test@john.com", :via => :sendmail)
      mail_object.deliver
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
padrino-mailer-0.9.7 test/test_mail_object.rb
padrino-mailer-0.9.6 test/test_mail_object.rb
padrino-mailer-0.9.5 test/test_mail_object.rb
padrino-mailer-0.9.4 test/test_mail_object.rb
padrino-mailer-0.9.3 test/test_mail_object.rb
padrino-mailer-0.9.2 test/test_mail_object.rb
padrino-mailer-0.9.1 test/test_mail_object.rb
padrino-mailer-0.9.0 test/test_mail_object.rb
padrino-mailer-0.8.5 test/test_mail_object.rb
padrino-mailer-0.8.4 test/test_mail_object.rb
padrino-mailer-0.8.3 test/test_mail_object.rb
padrino-mailer-0.8.2 test/test_mail_object.rb