Sha256: 649185b08d011e6adf344ce1a6366af57f17531aca769013dc5aeb62762df67b

Contents?: true

Size: 1.56 KB

Versions: 14

Compression:

Stored size: 1.56 KB

Contents

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

class NotificationMailerTest < 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 = []

    @controller = nil
    @article = Article.find(1)
    @user = User.find(1)

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

  def test_article
    @expected.subject = 'NotificationMailer#article'
    @expected.body    = read_fixture('article')
    @expected.date    = Time.now

#    assert_equal @expected.encoded, NotificationMailer.create_article(@controller, @article, @user).encoded
  end

  def test_comment
    @expected.subject = 'NotificationMailer#comment'
    @expected.body    = read_fixture('comment')
    @expected.date    = Time.now

#    assert_equal @expected.encoded, NotificationMailer.create_comment(@controller, @article, @user).encoded
  end

  def test_trackback
    @expected.subject = 'NotificationMailer#trackback'
    @expected.body    = read_fixture('trackback')
    @expected.date    = Time.now

#    assert_equal @expected.encoded, NotificationMailer.create_trackback(@controller, @article, @user).encoded
  end

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

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
typo-3.99.0 test/unit/notification_mailer_test.rb
typo-3.99.1 test/unit/notification_mailer_test.rb
typo-3.99.3 test/unit/notification_mailer_test.rb
typo-3.99.2 test/unit/notification_mailer_test.rb
typo-4.0.1 test/unit/notification_mailer_test.rb
typo-4.0.0 test/unit/notification_mailer_test.rb
typo-3.99.4 test/unit/notification_mailer_test.rb
typo-4.0.2 test/unit/notification_mailer_test.rb
typo-4.1.1 test/unit/notification_mailer_test.rb
typo-4.0.3 test/unit/notification_mailer_test.rb
typo-5.0.2 test/unit/notification_mailer_test.rb
typo-5.0.1 test/unit/notification_mailer_test.rb
typo-4.1 test/unit/notification_mailer_test.rb
typo-5.0 test/unit/notification_mailer_test.rb