From 58434e05fe828a89ac11dd4aa051bd1d5d1cfb09 Mon Sep 17 00:00:00 2001 From: Mike Moore Date: Mon, 24 Sep 2012 14:46:58 -0600 Subject: Support mailer tests using spec DSL Improve how mailer tests to resolve mailers from the test name. Add tests for mailer tests using the minitest spec DSL. --- actionmailer/lib/action_mailer/test_case.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'actionmailer/lib') diff --git a/actionmailer/lib/action_mailer/test_case.rb b/actionmailer/lib/action_mailer/test_case.rb index 251705ae50..e60dda9694 100644 --- a/actionmailer/lib/action_mailer/test_case.rb +++ b/actionmailer/lib/action_mailer/test_case.rb @@ -49,9 +49,11 @@ module ActionMailer end def determine_default_mailer(name) - name.sub(/Test$/, '').constantize - rescue NameError - raise NonInferrableMailerError.new(name) + mailer = determine_constant_from_test_name(name) do |constant| + Class === constant && constant < ActionMailer::Base + end + raise NonInferrableMailerError.new(name) if mailer.nil? + mailer end end -- cgit v1.2.3