Sha256: 7f8f1fb9012e7128b523a7e707bd857455a957b52f5cdba57fc6f26230fad217

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

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

class MailerTest < Test::Unit::TestCase
  FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures'
  CHARSET = "utf-8"

  include ActionMailer::Quoting

  def setup
    ActionMailer::Base.delivery_method = :test
    ActionMailer::Base.perform_deliveries = true
    ActionMailer::Base.deliveries = []

    @expected = TMail::Mail.new
    @expected.set_content_type "text", "plain", { "charset" => CHARSET }
    @expected.mime_version = '1.0'
  end

  def test_avtouch
    @expected.subject = 'give inventory'
    @expected.body    = read_fixture('avtouch')
    @expected.date    = Time.now
    @expected.from    = "webia@community-chest.net"
    @expected.to      = "88888888-4444-4444-4444-11111111@lsl.secondlife.com"

    avtouch_mail = Mailer.create_avtouch("88888888-4444-4444-4444-11111111", 
                      "147d465d-b625-7f9a-ce06-18fcbd1d9d44",
                      "cc pan")
    assert_equal @expected.encoded, avtouch_mail.encoded
  end

  private
    def read_fixture(action)
      IO.readlines("#{FIXTURES_PATH}/mailer/#{action}")
    end

    def encode(subject)
      quoted_printable(subject, CHARSET)
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
advertnet-1.0.0 test/unit/mailer_test.rb
advertnet-1.0.1 test/unit/mailer_test.rb