mirror of
https://github.com/github/rails.git
synced 2026-01-29 00:08:15 -05:00
Add example for default_url_options[:host] to generated mailers.
Signed-off-by: Joshua Peek <josh@joshpeek.com>
This commit is contained in:
committed by
Joshua Peek
parent
29ea0f68aa
commit
69a5c1df82
@@ -1,4 +1,7 @@
|
||||
class <%= class_name %> < ActionMailer::Base
|
||||
|
||||
# change to your domain name
|
||||
default_url_options[:host] = 'example.com'
|
||||
<% for action in actions -%>
|
||||
|
||||
def <%= action %>(sent_at = Time.now)
|
||||
@@ -7,7 +10,8 @@ class <%= class_name %> < ActionMailer::Base
|
||||
from ''
|
||||
sent_on sent_at
|
||||
|
||||
body :action => '<%= action %>'
|
||||
body :greeting => 'Hi,'
|
||||
end
|
||||
<% end -%>
|
||||
|
||||
end
|
||||
|
||||
@@ -13,10 +13,13 @@ class RailsMailerGeneratorTest < GeneratorTestCase
|
||||
"from ''",
|
||||
"sent_on sent_at",
|
||||
"",
|
||||
"body :action => 'reset_password'"
|
||||
"body :greeting => 'Hi,'"
|
||||
],
|
||||
body.split("\n").map{|line| line.sub(' '*4, '') }
|
||||
end
|
||||
|
||||
assert_match /^ default_url_options\[:host\] = 'example.com'$/m, model,
|
||||
'model should include default_url_options :host declaration'
|
||||
end
|
||||
|
||||
assert_generated_views_for :notifier, 'reset_password.erb'
|
||||
|
||||
Reference in New Issue
Block a user