diff options
author | Joel Chippindale <joel.chippindale@gmail.com> | 2008-11-11 09:45:53 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-11-11 09:46:29 -0600 |
commit | c65075feb6c4ce15582bc08411e6698d782249a7 (patch) | |
tree | 24f4f15871daeb3cf4582c168a01c844f86d2b73 | |
parent | a62e9e90d8f47a643c9355f782ab4891fa8fefaa (diff) | |
download | rails-c65075feb6c4ce15582bc08411e6698d782249a7.tar.gz rails-c65075feb6c4ce15582bc08411e6698d782249a7.tar.bz2 rails-c65075feb6c4ce15582bc08411e6698d782249a7.zip |
Fixed method_missing for ActionMailer so it no longer matches methods where deliver or create are not a suffix [#1318 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
-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 |