Sha256: 20e8c472eb2bac11333beb97bf60667a7323d5012a90d057816c9831dd7bded0

Contents?: true

Size: 1.11 KB

Versions: 43

Compression:

Stored size: 1.11 KB

Contents

require 'helper'
require 'sinatra_more'

class TestMailObject < Test::Unit::TestCase
  context 'for #deliver method' do
    should "send mail with attributes default to sendmail no smtp" do
      mail_object = SinatraMore::MailObject.new({:to => "test@john.com", :from => "sender@sent.com", :body => "Hello"}, {})
      Pony.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 = SinatraMore::MailObject.new({:to => "test@john.com", :body => "Hello"}, { :host => 'smtp.gmail.com' })
      Pony.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 = SinatraMore::MailObject.new({:to => "test@john.com", :via => :sendmail }, { :host => 'smtp.gmail.com' })
      Pony.expects(:mail).with(:to => "test@john.com", :via => :sendmail)
      mail_object.deliver
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
sinatra_more-0.3.23 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.22 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.21 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.18 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.16 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.15 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.14 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.13 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.12 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.11 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.10 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.9 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.8 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.7 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.6 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.5 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.4 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.3 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.2 test/mailer_plugin/test_mail_object.rb
sinatra_more-0.3.1 test/mailer_plugin/test_mail_object.rb