diff options
author | James Mead <james@floehopper.org> | 2008-08-29 15:08:16 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-08-29 15:09:47 -0500 |
commit | 3cf773b187e803e16b8237e5923fa4c1139cde8a (patch) | |
tree | d1d62af672f28c39f7bafa980f0dd35d9ddfcc47 /actionmailer/test | |
parent | 99492bad885aa0ee44c770e2c61ad36c3058c697 (diff) | |
download | rails-3cf773b187e803e16b8237e5923fa4c1139cde8a.tar.gz rails-3cf773b187e803e16b8237e5923fa4c1139cde8a.tar.bz2 rails-3cf773b187e803e16b8237e5923fa4c1139cde8a.zip |
ActionMailer should respond_to? to methods handled by method_missing [#700 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionmailer/test')
-rw-r--r-- | actionmailer/test/mail_service_test.rb | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb index 882b07d675..f57c6f3fb8 100644 --- a/actionmailer/test/mail_service_test.rb +++ b/actionmailer/test/mail_service_test.rb @@ -968,3 +968,55 @@ class MethodNamingTest < Test::Unit::TestCase end end end + +class RespondToTest < Test::Unit::TestCase + class RespondToMailer < ActionMailer::Base; end + + def setup + set_delivery_method :test + end + + def teardown + restore_delivery_method + end + + def test_should_respond_to_new + assert RespondToMailer.respond_to?(:new) + end + + def test_should_respond_to_create_with_template_suffix + assert RespondToMailer.respond_to?(:create_any_old_template) + end + + def test_should_respond_to_deliver_with_template_suffix + assert RespondToMailer.respond_to?(:deliver_any_old_template) + end + + def test_should_not_respond_to_new_with_template_suffix + assert !RespondToMailer.respond_to?(:new_any_old_template) + end + + def test_should_not_respond_to_create_with_template_suffix_unless_it_is_separated_by_an_underscore + assert !RespondToMailer.respond_to?(:createany_old_template) + end + + def test_should_not_respond_to_deliver_with_template_suffix_unless_it_is_separated_by_an_underscore + assert !RespondToMailer.respond_to?(:deliverany_old_template) + end + + def test_should_not_respond_to_create_with_template_suffix_if_it_begins_with_a_uppercase_letter + assert !RespondToMailer.respond_to?(:create_Any_old_template) + end + + def test_should_not_respond_to_deliver_with_template_suffix_if_it_begins_with_a_uppercase_letter + assert !RespondToMailer.respond_to?(:deliver_Any_old_template) + end + + def test_should_not_respond_to_create_with_template_suffix_if_it_begins_with_a_digit + assert !RespondToMailer.respond_to?(:create_1_template) + end + + def test_should_not_respond_to_deliver_with_template_suffix_if_it_begins_with_a_digit + assert !RespondToMailer.respond_to?(:deliver_1_template) + end +end |