aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG.md36
-rw-r--r--actionpack/lib/action_controller/test_case.rb24
-rw-r--r--actionpack/lib/action_dispatch/http/parameters.rb8
-rw-r--r--actionpack/lib/action_dispatch/http/request.rb9
-rw-r--r--actionpack/lib/action_dispatch/http/response.rb16
-rw-r--r--actionpack/lib/action_dispatch/journey/formatter.rb15
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb20
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb85
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/dom.rb3
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/selector.rb3
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/tag.rb3
-rw-r--r--actionpack/test/controller/test_case_test.rb25
-rw-r--r--actionpack/test/dispatch/response_test.rb18
-rw-r--r--actionpack/test/dispatch/routing/route_set_test.rb64
-rw-r--r--actionpack/test/dispatch/routing_test.rb34
-rw-r--r--actionpack/test/routing/helper_test.rb14
16 files changed, 51 insertions, 326 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index 838380ff71..2e5088cfbe 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -1,3 +1,39 @@
+* Remove deprecated assertion files.
+
+ *Rafael Mendonça França*
+
+* Remove deprecated usage of string keys in URL helpers.
+
+ *Rafael Mendonça França*
+
+* Remove deprecated `only_path` option on `*_path` helpers.
+
+ *Rafael Mendonça França*
+
+* Remove deprecated `NamedRouteCollection#helpers`.
+
+ *Rafael Mendonça França*
+
+* Remove deprecated support to define routes with `:to` option that doesn't contain `#`.
+
+ *Rafael Mendonça França*
+
+* Remove deprecated `ActionDispatch::Response#to_ary`.
+
+ *Rafael Mendonça França*
+
+* Remove deprecated `ActionDispatch::Request#deep_munge`.
+
+ *Rafael Mendonça França*
+
+* Remove deprecated `ActionDispatch::Http::Parameters#symbolized_path_parameters`.
+
+ *Rafael Mendonça França*
+
+* Remove deprecated option `use_route` in controller tests.
+
+ *Rafael Mendonça França*
+
* Ensure `append_info_to_payload` is called even if an exception is raised.
Fixes an issue where when an exception is raised in the request the additonal
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index 9a77f179d3..2e6c58b83a 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -2,7 +2,6 @@ require 'rack/session/abstract/id'
require 'active_support/core_ext/object/to_query'
require 'active_support/core_ext/module/anonymous'
require 'active_support/core_ext/hash/keys'
-require 'active_support/deprecation'
require 'rails-dom-testing'
@@ -714,28 +713,7 @@ module ActionController
:relative_url_root => nil,
:_recall => @request.path_parameters)
- if route_name = options.delete(:use_route)
- ActiveSupport::Deprecation.warn <<-MSG.squish
- Passing the `use_route` option in functional tests are deprecated.
- Support for this option in the `process` method (and the related
- `get`, `head`, `post`, `patch`, `put` and `delete` helpers) will
- be removed in the next version without replacement.
-
- Functional tests are essentially unit tests for controllers and
- they should not require knowledge to how the application's routes
- are configured. Instead, you should explicitly pass the appropiate
- params to the `process` method.
-
- Previously the engines guide also contained an incorrect example
- that recommended using this option to test an engine's controllers
- within the dummy application. That recommendation was incorrect
- and has since been corrected. Instead, you should override the
- `@routes` variable in the test case with `Foo::Engine.routes`. See
- the updated engines guide for details.
- MSG
- end
-
- url, query_string = @routes.path_for(options, route_name).split("?", 2)
+ url, query_string = @routes.path_for(options).split("?", 2)
@request.env["SCRIPT_NAME"] = @controller.config.relative_url_root
@request.env["PATH_INFO"] = url
diff --git a/actionpack/lib/action_dispatch/http/parameters.rb b/actionpack/lib/action_dispatch/http/parameters.rb
index a5cd26a3c1..c2f05ecc86 100644
--- a/actionpack/lib/action_dispatch/http/parameters.rb
+++ b/actionpack/lib/action_dispatch/http/parameters.rb
@@ -1,6 +1,5 @@
require 'active_support/core_ext/hash/keys'
require 'active_support/core_ext/hash/indifferent_access'
-require 'active_support/deprecation'
module ActionDispatch
module Http
@@ -25,13 +24,6 @@ module ActionDispatch
@env[PARAMETERS_KEY] = parameters
end
- def symbolized_path_parameters
- ActiveSupport::Deprecation.warn(
- '`symbolized_path_parameters` is deprecated. Please use `path_parameters`.'
- )
- path_parameters
- end
-
# Returns a hash with the \parameters used to form the \path of the request.
# Returned hash keys are strings:
#
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb
index d211ea2b77..cadbfc88cb 100644
--- a/actionpack/lib/action_dispatch/http/request.rb
+++ b/actionpack/lib/action_dispatch/http/request.rb
@@ -337,15 +337,6 @@ module ActionDispatch
LOCALHOST =~ remote_addr && LOCALHOST =~ remote_ip
end
- # Extracted into ActionDispatch::Request::Utils.deep_munge, but kept here for backwards compatibility.
- def deep_munge(hash)
- ActiveSupport::Deprecation.warn(
- 'This method has been extracted into `ActionDispatch::Request::Utils.deep_munge`. Please start using that instead.'
- )
-
- Utils.deep_munge(hash)
- end
-
protected
def parse_query(qs)
Utils.deep_munge(super)
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb
index 33de2f8b5f..4061ea71a3 100644
--- a/actionpack/lib/action_dispatch/http/response.rb
+++ b/actionpack/lib/action_dispatch/http/response.rb
@@ -1,6 +1,4 @@
require 'active_support/core_ext/module/attribute_accessors'
-require 'active_support/core_ext/string/filters'
-require 'active_support/deprecation'
require 'action_dispatch/http/filter_redirect'
require 'monitor'
@@ -284,20 +282,6 @@ module ActionDispatch # :nodoc:
end
alias prepare! to_a
- # Be super clear that a response object is not an Array. Defining this
- # would make implicit splatting work, but it also makes adding responses
- # as arrays work, and "flattening" responses, cascading to the rack body!
- # Not sensible behavior.
- def to_ary
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
- `ActionDispatch::Response#to_ary` no longer performs implicit conversion
- to an array. Please use `response.to_a` instead, or a splat like `status,
- headers, body = *response`.
- MSG
-
- to_a
- end
-
# Returns the response cookies, converted to a Hash of (name => value) pairs
#
# assert_equal 'AuthorOfNewPage', r.cookies['author']
diff --git a/actionpack/lib/action_dispatch/journey/formatter.rb b/actionpack/lib/action_dispatch/journey/formatter.rb
index 177f586c0e..992c1a9efe 100644
--- a/actionpack/lib/action_dispatch/journey/formatter.rb
+++ b/actionpack/lib/action_dispatch/journey/formatter.rb
@@ -1,5 +1,4 @@
require 'action_controller/metal/exceptions'
-require 'active_support/deprecation'
module ActionDispatch
module Journey
@@ -81,9 +80,6 @@ module ActionDispatch
if named_routes.key?(name)
yield named_routes[name]
else
- # Make sure we don't show the deprecation warning more than once
- warned = false
-
routes = non_recursive(cache, options)
hash = routes.group_by { |_, r| r.score(options) }
@@ -92,17 +88,6 @@ module ActionDispatch
break if score < 0
hash[score].sort_by { |i, _| i }.each do |_, route|
- if name && !warned
- ActiveSupport::Deprecation.warn <<-MSG.squish
- You are trying to generate the URL for a named route called
- #{name.inspect} but no such route was found. In the future,
- this will result in an `ActionController::UrlGenerationError`
- exception.
- MSG
-
- warned = true
- end
-
yield route
end
end
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index b9e916078c..8b04dfaa45 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -4,11 +4,9 @@ require 'active_support/core_ext/hash/slice'
require 'active_support/core_ext/enumerable'
require 'active_support/core_ext/array/extract_options'
require 'active_support/core_ext/module/remove_method'
-require 'active_support/core_ext/string/filters'
require 'active_support/inflector'
require 'action_dispatch/routing/redirection'
require 'action_dispatch/routing/endpoint'
-require 'active_support/deprecation'
module ActionDispatch
module Routing
@@ -279,22 +277,8 @@ module ActionDispatch
end
def split_to(to)
- case to
- when Symbol
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
- Defining a route where `to` is a symbol is deprecated.
- Please change `to: :#{to}` to `action: :#{to}`.
- MSG
-
- [nil, to.to_s]
- when /#/ then to.split('#')
- when String
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
- Defining a route where `to` is a controller without an action is deprecated.
- Please change `to: :#{to}` to `controller: :#{to}`.
- MSG
-
- [to, nil]
+ if to =~ /#/
+ to.split('#')
else
[]
end
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index d7693bdcee..b4c861d306 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -6,7 +6,6 @@ require 'active_support/core_ext/object/to_query'
require 'active_support/core_ext/hash/slice'
require 'active_support/core_ext/module/remove_method'
require 'active_support/core_ext/array/extract_options'
-require 'active_support/core_ext/string/filters'
require 'action_controller/metal/exceptions'
require 'action_dispatch/http/request'
require 'action_dispatch/routing/endpoint'
@@ -87,7 +86,7 @@ module ActionDispatch
# named routes.
class NamedRouteCollection #:nodoc:
include Enumerable
- attr_reader :routes, :url_helpers_module
+ attr_reader :routes, :url_helpers_module, :path_helpers_module
def initialize
@routes = {}
@@ -102,14 +101,6 @@ module ActionDispatch
@path_helpers.include?(key) || @url_helpers.include?(key)
end
- def helpers
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
- `named_routes.helpers` is deprecated, please use `route_defined?(route_name)`
- to see if a named route was defined.
- MSG
- @path_helpers + @url_helpers
- end
-
def helper_names
@path_helpers.map(&:to_s) + @url_helpers.map(&:to_s)
end
@@ -138,7 +129,7 @@ module ActionDispatch
@url_helpers_module.send :undef_method, url_name
end
routes[key] = route
- define_url_helper @path_helpers_module, route, path_name, route.defaults, name, LEGACY
+ define_url_helper @path_helpers_module, route, path_name, route.defaults, name, PATH
define_url_helper @url_helpers_module, route, url_name, route.defaults, name, UNKNOWN
@path_helpers << path_name
@@ -170,25 +161,6 @@ module ActionDispatch
routes.length
end
- def path_helpers_module(warn = false)
- if warn
- mod = @path_helpers_module
- helpers = @path_helpers
- Module.new do
- include mod
-
- helpers.each do |meth|
- define_method(meth) do |*args, &block|
- ActiveSupport::Deprecation.warn("The method `#{meth}` cannot be used here as a full URL is required. Use `#{meth.to_s.sub(/_path$/, '_url')}` instead")
- super(*args, &block)
- end
- end
- end
- else
- @path_helpers_module
- end
- end
-
class UrlHelper # :nodoc:
def self.create(route, options, route_name, url_strategy)
if optimize_helper?(route)
@@ -271,7 +243,7 @@ module ActionDispatch
controller_options = t.url_options
options = controller_options.merge @options
hash = handle_positional_args(controller_options,
- deprecate_string_options(inner_options) || {},
+ inner_options || {},
args,
options,
@segment_keys)
@@ -299,22 +271,6 @@ module ActionDispatch
result.merge!(inner_options)
end
-
- DEPRECATED_STRING_OPTIONS = %w[controller action]
-
- def deprecate_string_options(options)
- options ||= {}
- deprecated_string_options = options.keys & DEPRECATED_STRING_OPTIONS
- if deprecated_string_options.any?
- msg = "Calling URL helpers with string keys #{deprecated_string_options.join(", ")} is deprecated. Use symbols instead."
- ActiveSupport::Deprecation.warn(msg)
- deprecated_string_options.each do |option|
- value = options.delete(option)
- options[option.to_sym] = value
- end
- end
- options
- end
end
private
@@ -346,34 +302,7 @@ module ActionDispatch
# :stopdoc:
# strategy for building urls to send to the client
PATH = ->(options) { ActionDispatch::Http::URL.path_for(options) }
- FULL = ->(options) { ActionDispatch::Http::URL.full_url_for(options) }
UNKNOWN = ->(options) { ActionDispatch::Http::URL.url_for(options) }
- LEGACY = ->(options) {
- if options.key?(:only_path)
- if options[:only_path]
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
- You are calling a `*_path` helper with the `only_path` option
- explicitly set to `true`. This option will stop working on
- path helpers in Rails 5. Simply remove the `only_path: true`
- argument from your call as it is redundant when applied to a
- path helper.
- MSG
-
- PATH.call(options)
- else
- ActiveSupport::Deprecation.warn(<<-MSG.squish)
- You are calling a `*_path` helper with the `only_path` option
- explicitly set to `false`. This option will stop working on
- path helpers in Rails 5. Use the corresponding `*_url` helper
- instead.
- MSG
-
- FULL.call(options)
- end
- else
- PATH.call(options)
- end
- }
# :startdoc:
attr_accessor :formatter, :set, :named_routes, :default_scope, :router
@@ -508,12 +437,10 @@ module ActionDispatch
if supports_path
path_helpers = routes.named_routes.path_helpers_module
- else
- path_helpers = routes.named_routes.path_helpers_module(true)
- end
- include path_helpers
- extend path_helpers
+ include path_helpers
+ extend path_helpers
+ end
# plus a singleton class method called _routes ...
included do
diff --git a/actionpack/lib/action_dispatch/testing/assertions/dom.rb b/actionpack/lib/action_dispatch/testing/assertions/dom.rb
deleted file mode 100644
index fb579b52fe..0000000000
--- a/actionpack/lib/action_dispatch/testing/assertions/dom.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-require 'active_support/deprecation'
-
-ActiveSupport::Deprecation.warn("ActionDispatch::Assertions::DomAssertions has been extracted to the rails-dom-testing gem.") \ No newline at end of file
diff --git a/actionpack/lib/action_dispatch/testing/assertions/selector.rb b/actionpack/lib/action_dispatch/testing/assertions/selector.rb
deleted file mode 100644
index 7361e6c44b..0000000000
--- a/actionpack/lib/action_dispatch/testing/assertions/selector.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-require 'active_support/deprecation'
-
-ActiveSupport::Deprecation.warn("ActionDispatch::Assertions::SelectorAssertions has been extracted to the rails-dom-testing gem.")
diff --git a/actionpack/lib/action_dispatch/testing/assertions/tag.rb b/actionpack/lib/action_dispatch/testing/assertions/tag.rb
deleted file mode 100644
index da98b1d6ce..0000000000
--- a/actionpack/lib/action_dispatch/testing/assertions/tag.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-require 'active_support/deprecation'
-
-ActiveSupport::Deprecation.warn('`ActionDispatch::Assertions::TagAssertions` has been extracted to the rails-dom-testing gem.')
diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb
index ba2ff7d12c..2e1f21c645 100644
--- a/actionpack/test/controller/test_case_test.rb
+++ b/actionpack/test/controller/test_case_test.rb
@@ -521,18 +521,6 @@ XML
end
end
- def test_use_route
- with_routing do |set|
- set.draw do
- get 'via_unnamed_route', to: 'test_case_test/test#test_uri'
- get 'via_named_route', as: :a_named_route, to: 'test_case_test/test#test_uri'
- end
-
- assert_deprecated { get :test_uri, use_route: :a_named_route }
- assert_equal '/via_named_route', @response.body
- end
- end
-
def test_assert_realistic_path_parameters
get :test_params, :id => 20, :foo => Object.new
@@ -790,19 +778,6 @@ module EngineControllerTests
assert_equal @response.body, 'bar'
end
end
-
- class BarControllerTestWithHostApplicationRouteSet < ActionController::TestCase
- tests BarController
-
- def test_use_route
- with_routing do |set|
- set.draw { mount Engine => '/foo' }
-
- assert_deprecated { get :index, use_route: :foo }
- assert_equal @response.body, 'bar'
- end
- end
- end
end
class InferringClassNameTest < ActionController::TestCase
diff --git a/actionpack/test/dispatch/response_test.rb b/actionpack/test/dispatch/response_test.rb
index 48342e252a..c61423dce4 100644
--- a/actionpack/test/dispatch/response_test.rb
+++ b/actionpack/test/dispatch/response_test.rb
@@ -231,9 +231,9 @@ class ResponseTest < ActiveSupport::TestCase
assert_equal ['Not Found'], body.each.to_a
end
- test "[response].flatten does not recurse infinitely" do
+ test "[response.to_a].flatten does not recurse infinitely" do
Timeout.timeout(1) do # use a timeout to prevent it stalling indefinitely
- status, headers, body = assert_deprecated { [@response].flatten }
+ status, headers, body = [@response.to_a].flatten
assert_equal @response.status, status
assert_equal @response.headers, headers
assert_equal @response.body, body.each.to_a.join
@@ -251,20 +251,6 @@ class ResponseTest < ActiveSupport::TestCase
status, headers, body = Rack::ContentLength.new(app).call(env)
assert_equal '5', headers['Content-Length']
end
-
- test "implicit destructuring and Array conversion is deprecated" do
- response = ActionDispatch::Response.new(404, { 'Content-Type' => 'text/plain' }, ['Not Found'])
-
- assert_deprecated do
- status, headers, body = response
-
- assert_equal 404, status
- assert_equal({ 'Content-Type' => 'text/plain' }, headers)
- assert_equal ['Not Found'], body.each.to_a
- end
-
- assert_deprecated { response.to_ary }
- end
end
class ResponseIntegrationTest < ActionDispatch::IntegrationTest
diff --git a/actionpack/test/dispatch/routing/route_set_test.rb b/actionpack/test/dispatch/routing/route_set_test.rb
index 8bdb5733dd..fe52c50336 100644
--- a/actionpack/test/dispatch/routing/route_set_test.rb
+++ b/actionpack/test/dispatch/routing/route_set_test.rb
@@ -105,50 +105,6 @@ module ActionDispatch
assert_equal 'http://example.com/foo', url_helpers.foo_url(only_path: false)
end
- test "only_path: true with *_path" do
- draw do
- get 'foo', to: SimpleApp.new('foo#index')
- end
-
- assert_deprecated do
- assert_equal '/foo', url_helpers.foo_path(only_path: true)
- end
- end
-
- test "only_path: false with *_path with global :host option" do
- @set.default_url_options = { host: 'example.com' }
-
- draw do
- get 'foo', to: SimpleApp.new('foo#index')
- end
-
- assert_deprecated do
- assert_equal 'http://example.com/foo', url_helpers.foo_path(only_path: false)
- end
- end
-
- test "only_path: false with *_path with local :host option" do
- draw do
- get 'foo', to: SimpleApp.new('foo#index')
- end
-
- assert_deprecated do
- assert_equal 'http://example.com/foo', url_helpers.foo_path(only_path: false, host: 'example.com')
- end
- end
-
- test "only_path: false with *_path with no :host option" do
- draw do
- get 'foo', to: SimpleApp.new('foo#index')
- end
-
- assert_deprecated do
- assert_raises ArgumentError do
- assert_equal 'http://example.com/foo', url_helpers.foo_path(only_path: false)
- end
- end
- end
-
test "explicit keys win over implicit keys" do
draw do
resources :foo do
@@ -172,26 +128,6 @@ module ActionDispatch
assert_equal '/a/users/1', url_helpers.user_path(1, foo: 'a')
end
- test "stringified controller and action keys are properly symbolized" do
- draw do
- root 'foo#bar'
- end
-
- assert_deprecated do
- assert_equal '/', url_helpers.root_path('controller' => 'foo', 'action' => 'bar')
- end
- end
-
- test "mix of string and symbol keys are properly symbolized" do
- draw do
- root 'foo#bar'
- end
-
- assert_deprecated do
- assert_equal '/', url_helpers.root_path('controller' => 'foo', :action => 'bar')
- end
- end
-
private
def draw(&block)
@set.draw(&block)
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index aae95fb355..450681c356 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -3331,30 +3331,6 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
assert_equal 'comments#index', @response.body
end
- def test_mix_symbol_to_controller_action
- assert_deprecated do
- draw do
- get '/projects', controller: 'project_files',
- action: 'index',
- to: :show
- end
- end
- get '/projects'
- assert_equal 'project_files#show', @response.body
- end
-
- def test_mix_string_to_controller_action_no_hash
- assert_deprecated do
- draw do
- get '/projects', controller: 'project_files',
- action: 'index',
- to: 'show'
- end
- end
- get '/projects'
- assert_equal 'show#index', @response.body
- end
-
def test_shallow_path_and_prefix_are_not_added_to_non_shallow_routes
draw do
scope shallow_path: 'projects', shallow_prefix: 'project' do
@@ -3629,15 +3605,13 @@ class TestNamespaceWithControllerOption < ActionDispatch::IntegrationTest
assert_match(/Missing :controller/, ex.message)
end
- def test_missing_action
+ def test_missing_controller_with_to
ex = assert_raises(ArgumentError) {
- assert_deprecated do
- draw do
- get '/foo/bar', :to => 'foo'
- end
+ draw do
+ get '/foo/bar', :to => 'foo'
end
}
- assert_match(/Missing :action/, ex.message)
+ assert_match(/Missing :controller/, ex.message)
end
def test_missing_action_on_hash
diff --git a/actionpack/test/routing/helper_test.rb b/actionpack/test/routing/helper_test.rb
index 09ca7ff73b..0028aaa629 100644
--- a/actionpack/test/routing/helper_test.rb
+++ b/actionpack/test/routing/helper_test.rb
@@ -26,20 +26,6 @@ module ActionDispatch
x.new.pond_duck_path Duck.new
end
end
-
- def test_path_deprecation
- rs = ::ActionDispatch::Routing::RouteSet.new
- rs.draw do
- resources :ducks
- end
-
- x = Class.new {
- include rs.url_helpers(false)
- }
- assert_deprecated do
- assert_equal '/ducks', x.new.ducks_path
- end
- end
end
end
end