aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionmailer/lib/action_mailer.rb2
-rw-r--r--actionmailer/lib/action_mailer/tmail_compat.rb10
-rw-r--r--actionmailer/test/tmail_compat_test.rb14
3 files changed, 26 insertions, 0 deletions
diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb
index 55ddbb24f4..039715c2f5 100644
--- a/actionmailer/lib/action_mailer.rb
+++ b/actionmailer/lib/action_mailer.rb
@@ -45,3 +45,5 @@ 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/tmail_compat.rb b/actionmailer/lib/action_mailer/tmail_compat.rb
new file mode 100644
index 0000000000..cacd79be27
--- /dev/null
+++ b/actionmailer/lib/action_mailer/tmail_compat.rb
@@ -0,0 +1,10 @@
+module Mail
+ class Message
+
+ def set_content_type(*args)
+ STDERR.puts("Message#set_content_type is deprecated, please just call Message#content_type with the same arguments.\n#{caller}")
+ content_type(*args)
+ 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
new file mode 100644
index 0000000000..9b0e91f5f8
--- /dev/null
+++ b/actionmailer/test/tmail_compat_test.rb
@@ -0,0 +1,14 @@
+require 'abstract_unit'
+
+class TmailCompatTest < Test::Unit::TestCase
+
+ def test_set_content_type_raises_deprecation_warning
+ mail = Mail.new
+ STDERR.expects(:puts) # Deprecation warning
+ assert_nothing_raised do
+ mail.set_content_type "text/plain"
+ end
+ assert_equal mail.content_type.string, "text/plain"
+ end
+
+end