Adding failing tests for calling just the action, instead of :create_action_name and :deliver_action_name
This commit is contained in:
parent
afc758297c
commit
73a9000402
@ -387,7 +387,8 @@ def initialize(method_name=nil, *args)
|
||||
process(method_name, *args) if method_name
|
||||
end
|
||||
|
||||
# TODO Add new delivery method goodness
|
||||
# TODO: Clean this up and refactor before Rails 3.0 release.
|
||||
# This works for now, but not neat
|
||||
def mail(headers = {})
|
||||
# Guard flag to prevent both the old and the new API from firing
|
||||
# Should be removed when old API is deprecated
|
||||
@ -446,6 +447,7 @@ def default_subject #:nodoc:
|
||||
I18n.t(:subject, :scope => [:actionmailer, mailer_scope, action_name], :default => action_name.humanize)
|
||||
end
|
||||
|
||||
# TODO: Move this into Mail
|
||||
def quote_fields(m, headers, charset) #:nodoc:
|
||||
m.subject ||= quote_if_necessary(headers[:subject], charset) if headers[:subject]
|
||||
m.to ||= quote_address_if_necessary(headers[:to], charset) if headers[:to]
|
||||
|
@ -327,7 +327,21 @@ def explicit_multipart_with_any(hash = {})
|
||||
test "ActionMailer should be told when Mail gets delivered" do
|
||||
BaseMailer.deliveries.clear
|
||||
BaseMailer.expects(:delivered_email).once
|
||||
email = BaseMailer.deliver_welcome
|
||||
BaseMailer.deliver_welcome
|
||||
assert_equal(1, BaseMailer.deliveries.length)
|
||||
end
|
||||
|
||||
test "Calling just the action should return the generated mail object" do
|
||||
BaseMailer.deliveries.clear
|
||||
email = BaseMailer.welcome
|
||||
assert_equal(0, BaseMailer.deliveries.length)
|
||||
assert_equal('The first email on new API!', email.subject)
|
||||
end
|
||||
|
||||
test "Calling deliver on the action should deliver the mail object" do
|
||||
BaseMailer.deliveries.clear
|
||||
BaseMailer.expects(:delivered_email).once
|
||||
BaseMailer.welcome.deliver
|
||||
assert_equal(1, BaseMailer.deliveries.length)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user