Sha256: f55889e5160c29dbc4ee5b9356f1ca40d60dbe19127a1d48159f1b015771b1f5

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 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 = Sinatra::MailerPlugin::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 = Sinatra::MailerPlugin::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 = Sinatra::MailerPlugin::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

4 entries across 4 versions & 1 rubygems

Version Path
darkhelmet-sinatra_more-0.3.36 test/mailer_plugin/test_mail_object.rb
darkhelmet-sinatra_more-0.3.35 test/mailer_plugin/test_mail_object.rb
darkhelmet-sinatra_more-0.3.34 test/mailer_plugin/test_mail_object.rb
darkhelmet-sinatra_more-0.3.33 test/mailer_plugin/test_mail_object.rb