diff options
-rw-r--r-- | actionmailer/lib/action_mailer/base.rb | 3 | ||||
-rw-r--r-- | actionmailer/test/mail_service_test.rb | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 17b5eaa8d1..19ce77ea5a 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -391,6 +391,7 @@ module ActionMailer #:nodoc: when 'create' then new(match[2], *parameters).mail when 'deliver' then new(match[2], *parameters).deliver! when 'new' then nil + else super end else super @@ -442,7 +443,7 @@ module ActionMailer #:nodoc: private def matches_dynamic_method?(method_name) #:nodoc: method_name = method_name.to_s - /(create|deliver)_([_a-z]\w*)/.match(method_name) || /^(new)$/.match(method_name) + /^(create|deliver)_([_a-z]\w*)/.match(method_name) || /^(new)$/.match(method_name) end end diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 8b1c9a8dca..b88beb3314 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -1046,6 +1046,10 @@ class RespondToTest < Test::Unit::TestCase assert !RespondToMailer.respond_to?(:deliver_1_template) end + def test_should_not_respond_to_method_where_deliver_is_not_a_suffix + assert !RespondToMailer.respond_to?(:foo_deliver_template) + end + def test_should_still_raise_exception_with_expected_message_when_calling_an_undefined_method error = assert_raises NoMethodError do RespondToMailer.not_a_method |