2007-02-09 09:04:31 +01:00
|
|
|
require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../test_helper'
|
2007-01-22 14:43:50 +01:00
|
|
|
|
|
|
|
class <%= class_name %>Test < Test::Unit::TestCase
|
2007-02-09 09:04:31 +01:00
|
|
|
FIXTURES_PATH = File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../fixtures'
|
2007-01-22 14:43:50 +01:00
|
|
|
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 }
|
2007-02-09 09:04:31 +01:00
|
|
|
@expected.mime_version = '1.0'
|
2007-01-22 14:43:50 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
<% for action in actions -%>
|
|
|
|
def test_<%= action %>
|
|
|
|
@expected.subject = '<%= class_name %>#<%= action %>'
|
|
|
|
@expected.body = read_fixture('<%= action %>')
|
|
|
|
@expected.date = Time.now
|
|
|
|
|
|
|
|
assert_equal @expected.encoded, <%= class_name %>.create_<%= action %>(@expected.date).encoded
|
|
|
|
end
|
|
|
|
|
|
|
|
<% end -%>
|
|
|
|
private
|
|
|
|
def read_fixture(action)
|
2007-02-09 09:04:31 +01:00
|
|
|
IO.readlines("#{FIXTURES_PATH}/<%= file_path %>/#{action}")
|
2007-01-22 14:43:50 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def encode(subject)
|
|
|
|
quoted_printable(subject, CHARSET)
|
|
|
|
end
|
|
|
|
end
|