source: de.wigbels.ruby/contact/test/unit/contactmailer_test.rb@ 8f3c501

Last change on this file since 8f3c501 was 7b7d827, checked in by njw <njw@…>, 11 years ago

opened projects: hothotwrite and contact

  • Property mode set to 100644
File size: 991 bytes
RevLine 
[7b7d827]1require File.dirname(__FILE__) + '/../test_helper'
2
3class ContactmailerTest < Test::Unit::TestCase
4 FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures'
5 CHARSET = "utf-8"
6
7 include ActionMailer::Quoting
8
9 def setup
10 ActionMailer::Base.delivery_method = :test
11 ActionMailer::Base.perform_deliveries = true
12 ActionMailer::Base.deliveries = []
13
14 @expected = TMail::Mail.new
15 @expected.set_content_type "text", "plain", { "charset" => CHARSET }
16 @expected.mime_version = '1.0'
17 end
18
19 def test_send_mail_to_contact
20 @expected.subject = 'Contactmailer#send_mail_to_contact'
21 @expected.body = read_fixture('send_mail_to_contact')
22 @expected.date = Time.now
23
24 assert_equal @expected.encoded, Contactmailer.create_send_mail_to_contact(@expected.date).encoded
25 end
26
27 private
28 def read_fixture(action)
29 IO.readlines("#{FIXTURES_PATH}/contactmailer/#{action}")
30 end
31
32 def encode(subject)
33 quoted_printable(subject, CHARSET)
34 end
35end
Note: See TracBrowser for help on using the repository browser.