mirror of https://github.com/rails/rails
Default sent_on time to now in ActionMailer
Signed-off-by: Michael Koziarski <michael@koziarski.com> [#2607 state:committed]
This commit is contained in:
parent
98450fd168
commit
5fdc33c1a3
|
@ -556,6 +556,7 @@ module ActionMailer #:nodoc:
|
||||||
@headers ||= {}
|
@headers ||= {}
|
||||||
@body ||= {}
|
@body ||= {}
|
||||||
@mime_version = @@default_mime_version.dup if @@default_mime_version
|
@mime_version = @@default_mime_version.dup if @@default_mime_version
|
||||||
|
@sent_on ||= Time.now
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_template(template, body)
|
def render_template(template, body)
|
||||||
|
|
|
@ -18,7 +18,6 @@ class TestMailer < ActionMailer::Base
|
||||||
@recipients = recipient
|
@recipients = recipient
|
||||||
@subject = "[Signed up] Welcome #{recipient}"
|
@subject = "[Signed up] Welcome #{recipient}"
|
||||||
@from = "system@loudthinking.com"
|
@from = "system@loudthinking.com"
|
||||||
@sent_on = Time.local(2004, 12, 12)
|
|
||||||
@body["recipient"] = recipient
|
@body["recipient"] = recipient
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -357,12 +356,14 @@ class ActionMailerTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_signed_up
|
def test_signed_up
|
||||||
|
Time.stubs(:now => Time.now)
|
||||||
|
|
||||||
expected = new_mail
|
expected = new_mail
|
||||||
expected.to = @recipient
|
expected.to = @recipient
|
||||||
expected.subject = "[Signed up] Welcome #{@recipient}"
|
expected.subject = "[Signed up] Welcome #{@recipient}"
|
||||||
expected.body = "Hello there, \n\nMr. #{@recipient}"
|
expected.body = "Hello there, \n\nMr. #{@recipient}"
|
||||||
expected.from = "system@loudthinking.com"
|
expected.from = "system@loudthinking.com"
|
||||||
expected.date = Time.local(2004, 12, 12)
|
expected.date = Time.now
|
||||||
|
|
||||||
created = nil
|
created = nil
|
||||||
assert_nothing_raised { created = TestMailer.create_signed_up(@recipient) }
|
assert_nothing_raised { created = TestMailer.create_signed_up(@recipient) }
|
||||||
|
|
Loading…
Reference in New Issue