From 2a3718f434ac9dfeac3473c41a78d81aba9dbc1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Sun, 19 Jun 2016 20:41:15 -0400 Subject: [PATCH] Remove deprecated access to mime types through constants --- actionpack/CHANGELOG.md | 4 +++ .../lib/action_dispatch/http/mime_type.rb | 26 ------------------- actionpack/test/dispatch/mime_type_test.rb | 12 --------- 3 files changed, 4 insertions(+), 38 deletions(-) diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index 6e281753c5..d21f771b4b 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -1,3 +1,7 @@ +* 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`. diff --git a/actionpack/lib/action_dispatch/http/mime_type.rb b/actionpack/lib/action_dispatch/http/mime_type.rb index b9121a577c..58eb8d0baf 100644 --- a/actionpack/lib/action_dispatch/http/mime_type.rb +++ b/actionpack/lib/action_dispatch/http/mime_type.rb @@ -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: diff --git a/actionpack/test/dispatch/mime_type_test.rb b/actionpack/test/dispatch/mime_type_test.rb index 421ae6e133..e558efb88d 100644 --- a/actionpack/test/dispatch/mime_type_test.rb +++ b/actionpack/test/dispatch/mime_type_test.rb @@ -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") -- GitLab