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

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

opened projects: hothotwrite and contact

  • Property mode set to 100644
File size: 991 bytes
Line 
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.