Skip to content
Browse files

Adding :transfer_encoding -> :content_transfer_encoding as part of Tm…

…ailCompat
  • Loading branch information...
1 parent 345e622 commit 79280a233fab8c60f14a506d13b7d98740225bc1 @mikel mikel committed Dec 30, 2009
View
2 actionmailer/lib/action_mailer.rb
@@ -45,5 +45,3 @@ module Text
autoload :Format, 'action_mailer/vendor/text_format'
end
-
-require 'action_mailer/tmail_compat'
View
3 actionmailer/lib/action_mailer/base.rb
@@ -1,5 +1,6 @@
require 'active_support/core_ext/class'
require 'mail'
+require 'action_mailer/tmail_compat'
module ActionMailer #:nodoc:
# Action Mailer allows you to send email from your application using a mailer model and views.
@@ -149,7 +150,7 @@ module ActionMailer #:nodoc:
#
# part "text/plain" do |p|
# p.body = render_message("signup-as-plain", :account => recipient)
- # p.transfer_encoding = "base64"
+ # p.content_transfer_encoding = "base64"
# end
# end
# end
View
2 actionmailer/lib/action_mailer/test_case.rb
@@ -1,5 +1,5 @@
require 'active_support/test_case'
-require 'mail'
+require 'action_mailer/base'
module ActionMailer
class NonInferrableMailerError < ::StandardError
View
11 actionmailer/lib/action_mailer/tmail_compat.rb
@@ -6,5 +6,16 @@ def set_content_type(*args)
content_type(*args)
end
+
+ alias :old_transfer_encoding :transfer_encoding
+ def transfer_encoding(value = nil)
+ if value
+ STDERR.puts("Message#transfer_encoding is deprecated, please call Message#content_transfer_encoding with the same arguments.\n#{caller}")
+ content_transfer_encoding(value)
+ else
+ old_transfer_encoding
+ end
+ end
+
end
end
View
9 actionmailer/test/tmail_compat_test.rb
@@ -10,5 +10,14 @@ def test_set_content_type_raises_deprecation_warning
end
assert_equal mail.content_type.string, "text/plain"
end
+
+ def test_transfer_encoding_raises_deprecation_warning
+ mail = Mail.new
+ STDERR.expects(:puts) # Deprecation warning
+ assert_nothing_raised do
+ mail.transfer_encoding "base64"
+ end
+ assert_equal mail.content_transfer_encoding.value, "base64"
+ end
end

0 comments on commit 79280a2

Please sign in to comment.
Something went wrong with that request. Please try again.