Remove deprecated access to mime types through constants

上级 98b83095
* Remove deprecated access to mime types through constants.
*Rafael Mendonça França*
* Remove deprecated support to non-keyword arguments in `ActionController::TestCase#process`,
`#get`, `#post`, `#patch`, `#put`, `#delete`, and `#head`.
......
......@@ -45,32 +45,6 @@ def fetch(type)
return type if type.is_a?(Type)
EXTENSION_LOOKUP.fetch(type.to_s) { |k| yield k }
end
def const_missing(sym)
ext = sym.downcase
if Mime[ext]
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Accessing mime types via constants is deprecated.
Please change `Mime::#{sym}` to `Mime[:#{ext}]`.
MSG
Mime[ext]
else
super
end
end
def const_defined?(sym, inherit = true)
ext = sym.downcase
if Mime[ext]
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Accessing mime types via constants is deprecated.
Please change `Mime.const_defined?(#{sym})` to `Mime[:#{ext}]`.
MSG
true
else
super
end
end
end
# Encapsulates the notion of a mime type. Can be used at render time, for example, with:
......
......@@ -167,18 +167,6 @@ class MimeTypeTest < ActiveSupport::TestCase
end
end
test "deprecated lookup" do
assert_deprecated do
Mime::HTML
end
end
test "deprecated const_defined?" do
assert_deprecated do
Mime.const_defined? :HTML
end
end
test "references gives preference to symbols before strings" do
assert_equal :html, Mime[:html].ref
another = Mime::Type.lookup("foo/bar")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册