diff --git a/actionmailer/lib/action_mailer/tmail_compat.rb b/actionmailer/lib/action_mailer/tmail_compat.rb index c6efdc53b67b9800890ee4f36066dce750344762..26962f972fe491adfc8a2289d29ec9335de64fff 100644 --- a/actionmailer/lib/action_mailer/tmail_compat.rb +++ b/actionmailer/lib/action_mailer/tmail_compat.rb @@ -17,7 +17,13 @@ def transfer_encoding(value = nil) old_transfer_encoding end end - + + def transfer_encoding=(value) + ActiveSupport::Deprecation.warn('Message#transfer_encoding= is deprecated, please call ' << + 'Message#content_transfer_encoding= with the same arguments', caller[0,2]) + self.content_transfer_encoding = value + end + def original_filename ActiveSupport::Deprecation.warn('Message#original_filename is deprecated, ' << 'please call Message#filename', caller[0,2]) diff --git a/actionmailer/test/old_base/tmail_compat_test.rb b/actionmailer/test/old_base/tmail_compat_test.rb index 7c1d9a07c1d0a566e9817e73f6d417272d89abe1..255205de8464a2ab0c582284c87f436427a99dc3 100644 --- a/actionmailer/test/old_base/tmail_compat_test.rb +++ b/actionmailer/test/old_base/tmail_compat_test.rb @@ -21,5 +21,15 @@ def test_transfer_encoding_raises_deprecation_warning end assert_equal mail.content_transfer_encoding, "base64" end + + def test_transfer_encoding_setter_raises_deprecation_warning + mail = Mail.new + assert_deprecated do + assert_nothing_raised do + mail.transfer_encoding = "base64" + end + end + assert_equal mail.content_transfer_encoding, "base64" + end end