mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Mailer generator should create passing tests
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@111 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
1188d3005a
commit
5ae593f10b
3 changed files with 5 additions and 7 deletions
|
@ -1,4 +1,3 @@
|
||||||
<%= class_name %>#<%= action %>
|
<%= class_name %>#<%= action %>
|
||||||
|
|
||||||
Find me in test/fixtures/<%= file_name %>/<%= action %>.
|
Find me in app/views/<%= file_name %>/<%= action %>.rhtml
|
||||||
I'm tested against the view in app/views/<%= file_name %>/<%= action %>.
|
|
||||||
|
|
|
@ -4,11 +4,12 @@ class <%= class_name %> < ActionMailer::Base
|
||||||
<% for action in actions -%>
|
<% for action in actions -%>
|
||||||
|
|
||||||
def <%= action %>(sent_on = Time.now)
|
def <%= action %>(sent_on = Time.now)
|
||||||
|
@subject = '<%= class_name %>#<%= action %>'
|
||||||
|
@body = {}
|
||||||
@recipients = ''
|
@recipients = ''
|
||||||
@from = ''
|
@from = ''
|
||||||
@subject = ''
|
|
||||||
@body = {}
|
|
||||||
@sent_on = sent_on
|
@sent_on = sent_on
|
||||||
|
@headers = {}
|
||||||
end
|
end
|
||||||
<% end -%>
|
<% end -%>
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,13 +10,11 @@ class <%= class_name %>Test < Test::Unit::TestCase
|
||||||
ActionMailer::Base.deliveries = []
|
ActionMailer::Base.deliveries = []
|
||||||
|
|
||||||
@expected = TMail::Mail.new
|
@expected = TMail::Mail.new
|
||||||
@expected.to = 'test@localhost'
|
|
||||||
@expected.from = 'test@localhost'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
<% for action in actions -%>
|
<% for action in actions -%>
|
||||||
def test_<%= action %>
|
def test_<%= action %>
|
||||||
@expected.subject = '<%= class_name %>#<%= action %> test mail'
|
@expected.subject = '<%= class_name %>#<%= action %>'
|
||||||
@expected.body = read_fixture('<%= action %>')
|
@expected.body = read_fixture('<%= action %>')
|
||||||
@expected.date = Time.now
|
@expected.date = Time.now
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue