diff options
Diffstat (limited to 'actionmailer/lib')
-rw-r--r-- | actionmailer/lib/action_mailer/base.rb | 6 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/test_case.rb | 25 |
2 files changed, 17 insertions, 14 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index cb289fd693..8f2c567e3e 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -100,12 +100,12 @@ module ActionMailer #:nodoc: # You can even use Action Pack helpers in these views. For example: # # You got a new note! - # <%= truncate(@note.body, 25) %> + # <%= truncate(@note.body, :length => 25) %> # # If you need to access the subject, from or the recipients in the view, you can do that through message object: # # You got a new note from <%= message.from %>! - # <%= truncate(@note.body, 25) %> + # <%= truncate(@note.body, :length => 25) %> # # # = Generating URLs @@ -524,7 +524,7 @@ module ActionMailer #:nodoc: # # * <tt>:subject</tt> - The subject of the message, if this is omitted, Action Mailer will # ask the Rails I18n class for a translated <tt>:subject</tt> in the scope of - # <tt>[:actionmailer, mailer_scope, action_name]</tt> or if this is missing, will translate the + # <tt>[mailer_scope, action_name]</tt> or if this is missing, will translate the # humanized version of the <tt>action_name</tt> # * <tt>:to</tt> - Who the message is destined for, can be a string of addresses, or an array # of addresses. diff --git a/actionmailer/lib/action_mailer/test_case.rb b/actionmailer/lib/action_mailer/test_case.rb index 63e18147f6..4e48c0260f 100644 --- a/actionmailer/lib/action_mailer/test_case.rb +++ b/actionmailer/lib/action_mailer/test_case.rb @@ -15,9 +15,22 @@ module ActionMailer include TestHelper + included do + class_attribute :_mailer_class + setup :initialize_test_deliveries + setup :set_expected_mail + end + 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 @@ -35,8 +48,6 @@ module ActionMailer end end - module InstanceMethods - protected def initialize_test_deliveries @@ -64,16 +75,8 @@ module ActionMailer def read_fixture(action) IO.readlines(File.join(Rails.root, 'test', 'fixtures', self.class.mailer_class.name.underscore, action)) end - end - - included do - class_attribute :_mailer_class - setup :initialize_test_deliveries - setup :set_expected_mail - end end include Behavior - end end |