aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
diff options
context:
space:
mode:
authorMikel Lindsaar <raasdnil@gmail.com>2009-12-30 20:43:56 +1100
committerMikel Lindsaar <raasdnil@gmail.com>2009-12-30 20:43:56 +1100
commit79280a233fab8c60f14a506d13b7d98740225bc1 (patch)
treefbc26c390914bc71a68ded585b3922c58b370bc2 /actionmailer
parent345e622a20fd14a356a69da40e527075b1117b52 (diff)
downloadrails-79280a233fab8c60f14a506d13b7d98740225bc1.tar.gz
rails-79280a233fab8c60f14a506d13b7d98740225bc1.tar.bz2
rails-79280a233fab8c60f14a506d13b7d98740225bc1.zip
Adding :transfer_encoding -> :content_transfer_encoding as part of TmailCompat
Diffstat (limited to 'actionmailer')
-rw-r--r--actionmailer/lib/action_mailer.rb2
-rw-r--r--actionmailer/lib/action_mailer/base.rb3
-rw-r--r--actionmailer/lib/action_mailer/test_case.rb2
-rw-r--r--actionmailer/lib/action_mailer/tmail_compat.rb11
-rw-r--r--actionmailer/test/tmail_compat_test.rb9
5 files changed, 23 insertions, 4 deletions
diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb
index 039715c2f5..55ddbb24f4 100644
--- a/actionmailer/lib/action_mailer.rb
+++ b/actionmailer/lib/action_mailer.rb
@@ -45,5 +45,3 @@ module Text
autoload :Format, 'action_mailer/vendor/text_format'
end
-
-require 'action_mailer/tmail_compat' \ No newline at end of file
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index aea2498d4d..f34a9bae47 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/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
diff --git a/actionmailer/lib/action_mailer/test_case.rb b/actionmailer/lib/action_mailer/test_case.rb
index 445abd0b89..e8632d4559 100644
--- a/actionmailer/lib/action_mailer/test_case.rb
+++ b/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
diff --git a/actionmailer/lib/action_mailer/tmail_compat.rb b/actionmailer/lib/action_mailer/tmail_compat.rb
index cacd79be27..0d6fc13347 100644
--- a/actionmailer/lib/action_mailer/tmail_compat.rb
+++ b/actionmailer/lib/action_mailer/tmail_compat.rb
@@ -6,5 +6,16 @@ module Mail
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 \ No newline at end of file
diff --git a/actionmailer/test/tmail_compat_test.rb b/actionmailer/test/tmail_compat_test.rb
index 9b0e91f5f8..faa267e3bf 100644
--- a/actionmailer/test/tmail_compat_test.rb
+++ b/actionmailer/test/tmail_compat_test.rb
@@ -10,5 +10,14 @@ class TmailCompatTest < Test::Unit::TestCase
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