mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
normalize arg for ActionMailer::TestCase tests method
This commit is contained in:
parent
6f429f375e
commit
0defbc6bfe
2 changed files with 36 additions and 1 deletions
|
@ -17,7 +17,14 @@ module ActionMailer
|
|||
|
||||
module ClassMethods
|
||||
def tests(mailer)
|
||||
self._mailer_class = mailer
|
||||
case mailer
|
||||
when String, Symbol
|
||||
self._mailer_class = mailer.to_s.camelize.constantize
|
||||
when Module
|
||||
self._mailer_class = mailer
|
||||
else
|
||||
raise NonInferrableMailerError.new(mailer)
|
||||
end
|
||||
end
|
||||
|
||||
def mailer_class
|
||||
|
|
28
actionmailer/test/test_test.rb
Normal file
28
actionmailer/test/test_test.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
require 'abstract_unit'
|
||||
|
||||
class TestTestMailer < ActionMailer::Base
|
||||
end
|
||||
|
||||
class CrazyNameMailerTest < ActionMailer::TestCase
|
||||
tests TestTestMailer
|
||||
|
||||
def test_set_mailer_class_manual
|
||||
assert_equal TestTestMailer, self.class.mailer_class
|
||||
end
|
||||
end
|
||||
|
||||
class CrazySymbolNameMailerTest < ActionMailer::TestCase
|
||||
tests :test_test_mailer
|
||||
|
||||
def test_set_mailer_class_manual_using_symbol
|
||||
assert_equal TestTestMailer, self.class.mailer_class
|
||||
end
|
||||
end
|
||||
|
||||
class CrazyStringNameMailerTest < ActionMailer::TestCase
|
||||
tests 'test_test_mailer'
|
||||
|
||||
def test_set_mailer_class_manual_using_string
|
||||
assert_equal TestTestMailer, self.class.mailer_class
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue