blob: d581965284aed17cc0520e9ed0bb5d0c426c93b0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
$:.unshift(File.dirname(__FILE__) + "/../lib/")
require 'test/unit'
require 'action_mailer'
class RenderMailer < ActionMailer::Base
def inline_template(recipient)
recipients recipient
subject "using helpers"
from "tester@example.com"
body render(:inline => "Hello, <%= @world %>", :body => { :world => "Earth" })
end
def file_template(recipient)
recipients recipient
subject "using helpers"
from "tester@example.com"
body render(:file => "signed_up", :body => { :recipient => recipient })
end
def initialize_defaults(method_name)
super
mailer_name "test_mailer"
end
end
RenderMailer.template_root = File.dirname(__FILE__) + "/fixtures"
class RenderHelperTest < Test::Unit::TestCase
def setup
ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries = []
@recipient = 'test@localhost'
end
def test_inline_template
mail = RenderMailer.create_inline_template(@recipient)
assert_equal "Hello, Earth", mail.body.strip
end
def test_file_template
mail = RenderMailer.create_file_template(@recipient)
assert_equal "Hello there, \n\nMr. test@localhost", mail.body.strip
end
end
|