From 66e4c560e99893b0d53c6f09ad59026d6aee5169 Mon Sep 17 00:00:00 2001 From: Joel Chippindale Date: Wed, 5 Nov 2008 09:34:26 +0000 Subject: [PATCH] Fixed matches_dynamic_method? for ActionMailer So that it no longer matches methods where deliver or create are not a prefix. --- actionmailer/lib/action_mailer/base.rb | 2 +- actionmailer/test/mail_service_test.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 043f56b..baf017c 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -440,7 +440,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 7f9540c..089a5da 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -1031,4 +1031,12 @@ class RespondToTest < Test::Unit::TestCase def test_should_not_respond_to_deliver_with_template_suffix_if_it_begins_with_a_digit assert !RespondToMailer.respond_to?(:deliver_1_template) end + + def test_should_not_respond_to_method_where_deliver_is_not_a_prefix + assert !RespondToMailer.respond_to?(:foo_deliver_template) + end + + def test_should_not_respond_to_method_where_create_is_not_a_prefix + assert !RespondToMailer.respond_to?(:foo_create_template) + end end -- 1.6.0.2