Methods
Included Modules
- ActionMailer::Quoting
Public Instance methods
[ show source ]
# File test/url_test.rb, line 26
26: def encode( text, charset="utf-8" )
27: quoted_printable( text, charset )
28: end
[ show source ]
# File test/url_test.rb, line 30
30: def new_mail( charset="utf-8" )
31: mail = TMail::Mail.new
32: mail.mime_version = "1.0"
33: if charset
34: mail.set_content_type "text", "plain", { "charset" => charset }
35: end
36: mail
37: end
[ show source ]
# File test/url_test.rb, line 39
39: def setup
40: ActionMailer::Base.delivery_method = :test
41: ActionMailer::Base.perform_deliveries = true
42: ActionMailer::Base.deliveries = []
43:
44: @recipient = 'test@localhost'
45: end
[ show source ]
# File test/url_test.rb, line 47
47: def test_signed_up_with_url
48: ActionController::Routing::Routes.draw do |map|
49: map.connect ':controller/:action/:id'
50: end
51:
52: expected = new_mail
53: expected.to = @recipient
54: expected.subject = "[Signed up] Welcome #{@recipient}"
55: expected.body = "Hello there, \n\nMr. #{@recipient}. Please see our greeting at http://example.com/welcome/greeting"
56: expected.from = "system@loudthinking.com"
57: expected.date = Time.local(2004, 12, 12)
58:
59: created = nil
60: assert_nothing_raised { created = TestMailer.create_signed_up_with_url(@recipient) }
61: assert_not_nil created
62: assert_equal expected.encoded, created.encoded
63:
64: assert_nothing_raised { TestMailer.deliver_signed_up_with_url(@recipient) }
65: assert_not_nil ActionMailer::Base.deliveries.first
66: assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded
67: end