mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Removed deprecated ActionMailer API and related tests
This commit is contained in:
parent
b865576873
commit
d500ad3f05
10 changed files with 6 additions and 1667 deletions
|
@ -40,12 +40,10 @@ require 'active_support/lazy_load_hooks'
|
|||
module ActionMailer
|
||||
extend ::ActiveSupport::Autoload
|
||||
|
||||
autoload :AdvAttrAccessor
|
||||
autoload :Collector
|
||||
autoload :Base
|
||||
autoload :DeliveryMethods
|
||||
autoload :MailHelper
|
||||
autoload :OldApi
|
||||
autoload :TestCase
|
||||
autoload :TestHelper
|
||||
end
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
module ActionMailer
|
||||
module AdvAttrAccessor #:nodoc:
|
||||
def adv_attr_accessor(name, deprecation=nil)
|
||||
ivar = "@#{name}"
|
||||
deprecation ||= "Please pass :#{name} as hash key to mail() instead"
|
||||
|
||||
class_eval <<-ACCESSORS, __FILE__, __LINE__ + 1
|
||||
def #{name}=(value)
|
||||
ActiveSupport::Deprecation.warn "#{name}= is deprecated. #{deprecation}"
|
||||
#{ivar} = value
|
||||
end
|
||||
|
||||
def #{name}(*args)
|
||||
raise ArgumentError, "expected 0 or 1 parameters" unless args.length <= 1
|
||||
if args.empty?
|
||||
ActiveSupport::Deprecation.warn "#{name}() is deprecated and will be removed in future versions."
|
||||
#{ivar} if instance_variable_names.include?(#{ivar.inspect})
|
||||
else
|
||||
ActiveSupport::Deprecation.warn "#{name}(value) is deprecated. #{deprecation}"
|
||||
#{ivar} = args.first
|
||||
end
|
||||
end
|
||||
ACCESSORS
|
||||
|
||||
self.protected_instance_variables << ivar if self.respond_to?(:protected_instance_variables)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,5 +1,4 @@
|
|||
require 'mail'
|
||||
require 'action_mailer/tmail_compat'
|
||||
require 'action_mailer/collector'
|
||||
require 'active_support/core_ext/array/wrap'
|
||||
require 'active_support/core_ext/object/blank'
|
||||
|
@ -131,9 +130,6 @@ module ActionMailer #:nodoc:
|
|||
#
|
||||
# config.action_mailer.default_url_options = { :host => "example.com" }
|
||||
#
|
||||
# Setting <tt>ActionMailer::Base.default_url_options</tt> directly is now deprecated, use the configuration
|
||||
# option mentioned above to set the default host.
|
||||
#
|
||||
# If you do decide to set a default <tt>:host</tt> for your mailers you want to use the
|
||||
# <tt>:only_path => false</tt> option when using <tt>url_for</tt>. This will ensure that absolute URLs are
|
||||
# generated because the <tt>url_for</tt> view helper will, by default, generate relative URLs when a
|
||||
|
@ -325,19 +321,6 @@ module ActionMailer #:nodoc:
|
|||
# * <tt>deliveries</tt> - Keeps an array of all the emails sent out through the Action Mailer with
|
||||
# <tt>delivery_method :test</tt>. Most useful for unit and functional testing.
|
||||
#
|
||||
# * <tt>default_charset</tt> - This is now deprecated, use the +default+ method above to
|
||||
# set the default +:charset+.
|
||||
#
|
||||
# * <tt>default_content_type</tt> - This is now deprecated, use the +default+ method above
|
||||
# to set the default +:content_type+.
|
||||
#
|
||||
# * <tt>default_mime_version</tt> - This is now deprecated, use the +default+ method above
|
||||
# to set the default +:mime_version+.
|
||||
#
|
||||
# * <tt>default_implicit_parts_order</tt> - This is now deprecated, use the +default+ method above
|
||||
# to set the default +:parts_order+. Parts Order is used when a message is built implicitly
|
||||
# (i.e. multiple parts are assembled from templates which specify the content type in their
|
||||
# filenames) this variable controls how the parts are ordered.
|
||||
class Base < AbstractController::Base
|
||||
include DeliveryMethods
|
||||
abstract!
|
||||
|
@ -352,7 +335,6 @@ module ActionMailer #:nodoc:
|
|||
self.protected_instance_variables = %w(@_action_has_layout)
|
||||
|
||||
helper ActionMailer::MailHelper
|
||||
include ActionMailer::OldApi
|
||||
|
||||
private_class_method :new #:nodoc:
|
||||
|
||||
|
|
|
@ -1,255 +0,0 @@
|
|||
require 'active_support/concern'
|
||||
require 'active_support/core_ext/object/try'
|
||||
require 'active_support/core_ext/object/blank'
|
||||
|
||||
module ActionMailer
|
||||
module OldApi #:nodoc:
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
extend ActionMailer::AdvAttrAccessor
|
||||
self.protected_instance_variables.concat %w(@parts @mail_was_called @headers)
|
||||
|
||||
# Specify the BCC addresses for the message
|
||||
adv_attr_accessor :bcc
|
||||
|
||||
# Specify the CC addresses for the message.
|
||||
adv_attr_accessor :cc
|
||||
|
||||
# Specify the charset to use for the message. This defaults to the
|
||||
# +default_charset+ specified for ActionMailer::Base.
|
||||
adv_attr_accessor :charset
|
||||
|
||||
# Specify the content type for the message. This defaults to <tt>text/plain</tt>
|
||||
# in most cases, but can be automatically set in some situations.
|
||||
adv_attr_accessor :content_type
|
||||
|
||||
# Specify the from address for the message.
|
||||
adv_attr_accessor :from
|
||||
|
||||
# Specify the address (if different than the "from" address) to direct
|
||||
# replies to this message.
|
||||
adv_attr_accessor :reply_to
|
||||
|
||||
# Specify the order in which parts should be sorted, based on content-type.
|
||||
# This defaults to the value for the +default_implicit_parts_order+.
|
||||
adv_attr_accessor :implicit_parts_order
|
||||
|
||||
# Defaults to "1.0", but may be explicitly given if needed.
|
||||
adv_attr_accessor :mime_version
|
||||
|
||||
# The recipient addresses for the message, either as a string (for a single
|
||||
# address) or an array (for multiple addresses).
|
||||
adv_attr_accessor :recipients, "Please pass :to as hash key to mail() instead"
|
||||
|
||||
# The date on which the message was sent. If not set (the default), the
|
||||
# header will be set by the delivery agent.
|
||||
adv_attr_accessor :sent_on, "Please pass :date as hash key to mail() instead"
|
||||
|
||||
# Specify the subject of the message.
|
||||
adv_attr_accessor :subject
|
||||
|
||||
# Specify the template name to use for current message. This is the "base"
|
||||
# template name, without the extension or directory, and may be used to
|
||||
# have multiple mailer methods share the same template.
|
||||
adv_attr_accessor :template, "Please pass :template_name or :template_path as hash key to mail() instead"
|
||||
|
||||
# Define the body of the message. This is either a Hash (in which case it
|
||||
# specifies the variables to pass to the template when it is rendered),
|
||||
# or a string, in which case it specifies the actual text of the message.
|
||||
adv_attr_accessor :body
|
||||
end
|
||||
|
||||
def process(method_name, *args)
|
||||
initialize_defaults(method_name)
|
||||
super
|
||||
unless @mail_was_called
|
||||
create_parts
|
||||
create_mail
|
||||
end
|
||||
@_message
|
||||
end
|
||||
|
||||
# Add a part to a multipart message, with the given content-type. The
|
||||
# part itself is yielded to the block so that other properties (charset,
|
||||
# body, headers, etc.) can be set on it.
|
||||
def part(params)
|
||||
ActiveSupport::Deprecation.warn "part() is deprecated and will be removed in future versions. " <<
|
||||
"Please pass a block to mail() instead."
|
||||
params = {:content_type => params} if String === params
|
||||
|
||||
if custom_headers = params.delete(:headers)
|
||||
params.merge!(custom_headers)
|
||||
end
|
||||
|
||||
part = Mail::Part.new(params)
|
||||
|
||||
yield part if block_given?
|
||||
@parts << part
|
||||
end
|
||||
|
||||
# Add an attachment to a multipart message. This is simply a part with the
|
||||
# content-disposition set to "attachment".
|
||||
def attachment(params, &block)
|
||||
ActiveSupport::Deprecation.warn "attachment() is deprecated and will be removed in future versions. " <<
|
||||
"Please use the attachments[] API instead."
|
||||
params = { :content_type => params } if String === params
|
||||
|
||||
params[:content] ||= params.delete(:data) || params.delete(:body)
|
||||
|
||||
if params[:filename]
|
||||
params = normalize_file_hash(params)
|
||||
else
|
||||
params = normalize_nonfile_hash(params)
|
||||
end
|
||||
|
||||
part(params, &block)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def normalize_nonfile_hash(params)
|
||||
content_disposition = "attachment;"
|
||||
|
||||
mime_type = params.delete(:mime_type)
|
||||
|
||||
if content_type = params.delete(:content_type)
|
||||
content_type = "#{mime_type || content_type};"
|
||||
end
|
||||
|
||||
params[:body] = params.delete(:data) if params[:data]
|
||||
|
||||
{ :content_type => content_type,
|
||||
:content_disposition => content_disposition }.merge(params)
|
||||
end
|
||||
|
||||
def normalize_file_hash(params)
|
||||
filename = File.basename(params.delete(:filename))
|
||||
content_disposition = "attachment; filename=\"#{File.basename(filename)}\""
|
||||
|
||||
mime_type = params.delete(:mime_type)
|
||||
|
||||
if (content_type = params.delete(:content_type)) && (content_type !~ /filename=/)
|
||||
content_type = "#{mime_type || content_type}; filename=\"#{filename}\""
|
||||
end
|
||||
|
||||
params[:body] = params.delete(:data) if params[:data]
|
||||
|
||||
{ :content_type => content_type,
|
||||
:content_disposition => content_disposition }.merge(params)
|
||||
end
|
||||
|
||||
def create_mail
|
||||
m = @_message
|
||||
|
||||
set_fields!({:subject => @subject, :to => @recipients, :from => @from,
|
||||
:bcc => @bcc, :cc => @cc, :reply_to => @reply_to}, @charset)
|
||||
|
||||
m.mime_version = @mime_version if @mime_version
|
||||
m.date = @sent_on.to_time rescue @sent_on if @sent_on
|
||||
|
||||
@headers.each { |k, v| m[k] = v }
|
||||
|
||||
real_content_type, ctype_attrs = parse_content_type
|
||||
main_type, sub_type = split_content_type(real_content_type)
|
||||
|
||||
if @parts.size == 1 && @parts.first.parts.empty?
|
||||
m.content_type([main_type, sub_type, ctype_attrs])
|
||||
m.body = @parts.first.body.encoded
|
||||
else
|
||||
@parts.each do |p|
|
||||
m.add_part(p)
|
||||
end
|
||||
|
||||
m.body.set_sort_order(@implicit_parts_order)
|
||||
m.body.sort_parts!
|
||||
|
||||
if real_content_type =~ /multipart/
|
||||
ctype_attrs.delete "charset"
|
||||
m.content_type([main_type, sub_type, ctype_attrs])
|
||||
end
|
||||
end
|
||||
|
||||
wrap_delivery_behavior!
|
||||
m.content_transfer_encoding = '8bit' unless m.body.only_us_ascii?
|
||||
|
||||
@_message
|
||||
end
|
||||
|
||||
# Set up the default values for the various instance variables of this
|
||||
# mailer. Subclasses may override this method to provide different
|
||||
# defaults.
|
||||
def initialize_defaults(method_name)
|
||||
@charset ||= self.class.default[:charset].try(:dup)
|
||||
@content_type ||= self.class.default[:content_type].try(:dup)
|
||||
@implicit_parts_order ||= self.class.default[:parts_order].try(:dup)
|
||||
@mime_version ||= self.class.default[:mime_version].try(:dup)
|
||||
|
||||
@cc, @bcc, @reply_to, @subject, @from, @recipients = nil, nil, nil, nil, nil, nil
|
||||
|
||||
@mailer_name ||= self.class.mailer_name.dup
|
||||
@template ||= method_name
|
||||
@mail_was_called = false
|
||||
|
||||
@parts ||= []
|
||||
@headers ||= {}
|
||||
@sent_on ||= Time.now
|
||||
@body ||= {}
|
||||
end
|
||||
|
||||
def create_parts
|
||||
if String === @body
|
||||
@parts.unshift create_inline_part(@body)
|
||||
elsif @parts.empty? || @parts.all? { |p| p.content_disposition =~ /^attachment/ }
|
||||
lookup_context.find_all(@template, [@mailer_name]).each do |template|
|
||||
self.formats = template.formats
|
||||
@parts << create_inline_part(render(:template => template), template.mime_type)
|
||||
end
|
||||
|
||||
if @parts.size > 1
|
||||
@content_type = "multipart/alternative" if @content_type !~ /^multipart/
|
||||
end
|
||||
|
||||
# If this is a multipart e-mail add the mime_version if it is not
|
||||
# already set.
|
||||
@mime_version ||= "1.0" unless @parts.empty?
|
||||
end
|
||||
end
|
||||
|
||||
def create_inline_part(body, mime_type=nil)
|
||||
ct = mime_type || "text/plain"
|
||||
main_type, sub_type = split_content_type(ct.to_s)
|
||||
|
||||
Mail::Part.new(
|
||||
:content_type => [main_type, sub_type, {:charset => charset}],
|
||||
:content_disposition => "inline",
|
||||
:body => body
|
||||
)
|
||||
end
|
||||
|
||||
def set_fields!(headers, charset) #:nodoc:
|
||||
m = @_message
|
||||
m.charset = charset
|
||||
m.subject ||= headers.delete(:subject) if headers[:subject]
|
||||
m.to ||= headers.delete(:to) if headers[:to]
|
||||
m.from ||= headers.delete(:from) if headers[:from]
|
||||
m.cc ||= headers.delete(:cc) if headers[:cc]
|
||||
m.bcc ||= headers.delete(:bcc) if headers[:bcc]
|
||||
m.reply_to ||= headers.delete(:reply_to) if headers[:reply_to]
|
||||
end
|
||||
|
||||
def split_content_type(ct)
|
||||
ct.to_s.split("/")
|
||||
end
|
||||
|
||||
def parse_content_type
|
||||
if @content_type.blank?
|
||||
[ nil, {} ]
|
||||
else
|
||||
ctype, *attrs = @content_type.split(/;\s*/)
|
||||
attrs = Hash[attrs.map { |attr| attr.split(/=/, 2) }]
|
||||
[ctype, {"charset" => @charset}.merge!(attrs)]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,37 +0,0 @@
|
|||
module Mail
|
||||
class Message
|
||||
|
||||
def set_content_type(*args)
|
||||
message = 'Message#set_content_type is deprecated, please just call ' <<
|
||||
'Message#content_type with the same arguments'
|
||||
ActiveSupport::Deprecation.warn(message, caller[0,2])
|
||||
content_type(*args)
|
||||
end
|
||||
|
||||
alias :old_transfer_encoding :transfer_encoding
|
||||
def transfer_encoding(value = nil)
|
||||
if value
|
||||
message = 'Message#transfer_encoding is deprecated, ' <<
|
||||
'please call Message#content_transfer_encoding with the same arguments'
|
||||
ActiveSupport::Deprecation.warn(message, caller[0,2])
|
||||
content_transfer_encoding(value)
|
||||
else
|
||||
old_transfer_encoding
|
||||
end
|
||||
end
|
||||
|
||||
def transfer_encoding=(value)
|
||||
message = 'Message#transfer_encoding= is deprecated, ' <<
|
||||
'please call Message#content_transfer_encoding= with the same arguments'
|
||||
ActiveSupport::Deprecation.warn(message, caller[0,2])
|
||||
self.content_transfer_encoding = value
|
||||
end
|
||||
|
||||
def original_filename
|
||||
message = 'Message#original_filename is deprecated, please call Message#filename'
|
||||
ActiveSupport::Deprecation.warn(message, caller[0,2])
|
||||
filename
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -11,13 +11,6 @@ class AMLogSubscriberTest < ActionMailer::TestCase
|
|||
end
|
||||
|
||||
class TestMailer < ActionMailer::Base
|
||||
def basic
|
||||
recipients "somewhere@example.com"
|
||||
subject "basic"
|
||||
from "basic@example.com"
|
||||
body "Hello world"
|
||||
end
|
||||
|
||||
def receive(mail)
|
||||
# Do nothing
|
||||
end
|
||||
|
@ -28,12 +21,12 @@ class AMLogSubscriberTest < ActionMailer::TestCase
|
|||
end
|
||||
|
||||
def test_deliver_is_notified
|
||||
TestMailer.basic.deliver
|
||||
BaseMailer.welcome.deliver
|
||||
wait
|
||||
assert_equal(1, @logger.logged(:info).size)
|
||||
assert_match(/Sent mail to somewhere@example.com/, @logger.logged(:info).first)
|
||||
assert_match(/Sent mail to system@test.lindsaar.net/, @logger.logged(:info).first)
|
||||
assert_equal(1, @logger.logged(:debug).size)
|
||||
assert_match(/Hello world/, @logger.logged(:debug).first)
|
||||
assert_match(/Welcome/, @logger.logged(:debug).first)
|
||||
end
|
||||
|
||||
def test_receive_is_notified
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
require 'abstract_unit'
|
||||
require 'action_mailer/adv_attr_accessor'
|
||||
|
||||
class AdvAttrTest < ActiveSupport::TestCase
|
||||
class Person
|
||||
cattr_reader :protected_instance_variables
|
||||
@@protected_instance_variables = []
|
||||
|
||||
extend ActionMailer::AdvAttrAccessor
|
||||
adv_attr_accessor :name
|
||||
end
|
||||
|
||||
def setup
|
||||
ActiveSupport::Deprecation.silenced = true
|
||||
@person = Person.new
|
||||
end
|
||||
|
||||
def teardown
|
||||
ActiveSupport::Deprecation.silenced = false
|
||||
end
|
||||
|
||||
def test_adv_attr
|
||||
assert_nil @person.name
|
||||
@person.name 'Bob'
|
||||
assert_equal 'Bob', @person.name
|
||||
end
|
||||
|
||||
def test_adv_attr_writer
|
||||
assert_nil @person.name
|
||||
@person.name = 'Bob'
|
||||
assert_equal 'Bob', @person.name
|
||||
end
|
||||
|
||||
def test_raise_an_error_with_multiple_args
|
||||
assert_raise(ArgumentError) { @person.name('x', 'y') }
|
||||
end
|
||||
|
||||
def test_ivar_is_added_to_protected_instnace_variables
|
||||
assert Person.protected_instance_variables.include?('@name')
|
||||
end
|
||||
end
|
|
@ -1,134 +0,0 @@
|
|||
require 'abstract_unit'
|
||||
|
||||
class RenderMailer < ActionMailer::Base
|
||||
def inline_template
|
||||
recipients 'test@localhost'
|
||||
subject "using helpers"
|
||||
from "tester@example.com"
|
||||
|
||||
@world = "Earth"
|
||||
body render(:inline => "Hello, <%= @world %>")
|
||||
end
|
||||
|
||||
def file_template
|
||||
recipients 'test@localhost'
|
||||
subject "using helpers"
|
||||
from "tester@example.com"
|
||||
|
||||
@recipient = 'test@localhost'
|
||||
body render(:file => "templates/signed_up")
|
||||
end
|
||||
|
||||
def no_instance_variable
|
||||
recipients 'test@localhost'
|
||||
subject "No Instance Variable"
|
||||
from "tester@example.com"
|
||||
|
||||
silence_warnings do
|
||||
body render(:inline => "Look, subject.nil? is <%= @subject.nil? %>!")
|
||||
end
|
||||
end
|
||||
|
||||
def multipart_alternative
|
||||
recipients 'test@localhost'
|
||||
subject 'multipart/alternative'
|
||||
from 'tester@example.com'
|
||||
|
||||
build_multipart_message(:foo => "bar")
|
||||
end
|
||||
|
||||
private
|
||||
def build_multipart_message(assigns = {})
|
||||
content_type "multipart/alternative"
|
||||
|
||||
part "text/plain" do |p|
|
||||
p.body = build_body_part('plain', assigns, :layout => false)
|
||||
end
|
||||
|
||||
part "text/html" do |p|
|
||||
p.body = build_body_part('html', assigns)
|
||||
end
|
||||
end
|
||||
|
||||
def build_body_part(content_type, assigns, options = {})
|
||||
ActiveSupport::Deprecation.silence do
|
||||
render "#{template}.#{content_type}", :body => assigns
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class FirstMailer < ActionMailer::Base
|
||||
def share
|
||||
recipients 'test@localhost'
|
||||
subject "using helpers"
|
||||
from "tester@example.com"
|
||||
end
|
||||
end
|
||||
|
||||
class SecondMailer < ActionMailer::Base
|
||||
def share
|
||||
recipients 'test@localhost'
|
||||
subject "using helpers"
|
||||
from "tester@example.com"
|
||||
end
|
||||
end
|
||||
|
||||
# CHANGED: Those tests were changed because body returns an object now
|
||||
# Instead of mail.body.strip, we should mail.body.to_s.strip
|
||||
class RenderHelperTest < Test::Unit::TestCase
|
||||
def setup
|
||||
set_delivery_method :test
|
||||
ActionMailer::Base.perform_deliveries = true
|
||||
ActionMailer::Base.deliveries.clear
|
||||
ActiveSupport::Deprecation.silenced = true
|
||||
|
||||
@recipient = 'test@localhost'
|
||||
end
|
||||
|
||||
def teardown
|
||||
ActiveSupport::Deprecation.silenced = false
|
||||
restore_delivery_method
|
||||
end
|
||||
|
||||
def test_inline_template
|
||||
mail = RenderMailer.inline_template
|
||||
assert_equal "Hello, Earth", mail.body.to_s.strip
|
||||
end
|
||||
|
||||
def test_file_template
|
||||
mail = RenderMailer.file_template
|
||||
assert_equal "Hello there,\n\nMr. test@localhost", mail.body.to_s.strip
|
||||
end
|
||||
|
||||
def test_no_instance_variable
|
||||
mail = RenderMailer.no_instance_variable.deliver
|
||||
assert_equal "Look, subject.nil? is true!", mail.body.to_s.strip
|
||||
end
|
||||
end
|
||||
|
||||
class FirstSecondHelperTest < Test::Unit::TestCase
|
||||
def setup
|
||||
set_delivery_method :test
|
||||
ActiveSupport::Deprecation.silenced = true
|
||||
ActionMailer::Base.perform_deliveries = true
|
||||
ActionMailer::Base.deliveries.clear
|
||||
|
||||
@recipient = 'test@localhost'
|
||||
end
|
||||
|
||||
def teardown
|
||||
ActiveSupport::Deprecation.silenced = false
|
||||
restore_delivery_method
|
||||
end
|
||||
|
||||
def test_ordering
|
||||
mail = FirstMailer.share
|
||||
assert_equal "first mail", mail.body.to_s.strip
|
||||
mail = SecondMailer.share
|
||||
assert_equal "second mail", mail.body.to_s.strip
|
||||
mail = FirstMailer.share
|
||||
assert_equal "first mail", mail.body.to_s.strip
|
||||
mail = SecondMailer.share
|
||||
assert_equal "second mail", mail.body.to_s.strip
|
||||
end
|
||||
end
|
File diff suppressed because it is too large
Load diff
|
@ -1,42 +0,0 @@
|
|||
require 'abstract_unit'
|
||||
|
||||
class TmailCompatTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
@silence = ActiveSupport::Deprecation.silenced
|
||||
ActiveSupport::Deprecation.silenced = false
|
||||
end
|
||||
|
||||
def teardown
|
||||
ActiveSupport::Deprecation.silenced = @silence
|
||||
end
|
||||
|
||||
def test_set_content_type_raises_deprecation_warning
|
||||
mail = Mail.new
|
||||
assert_deprecated do
|
||||
assert_nothing_raised do
|
||||
mail.set_content_type "text/plain"
|
||||
end
|
||||
end
|
||||
assert_equal mail.mime_type, "text/plain"
|
||||
end
|
||||
|
||||
def test_transfer_encoding_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
|
||||
|
||||
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
|
Loading…
Reference in a new issue