diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-02 23:16:51 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-04 11:58:41 -0300 |
commit | e4cfd353a47369dd32198b0e67b8cbb2f9a1c548 (patch) | |
tree | c6faa39f027512f0f1d1ca1ac44c28182261a933 /actionpack | |
parent | 755dcd0691f74079c24196135f89b917062b0715 (diff) | |
download | rails-e4cfd353a47369dd32198b0e67b8cbb2f9a1c548.tar.gz rails-e4cfd353a47369dd32198b0e67b8cbb2f9a1c548.tar.bz2 rails-e4cfd353a47369dd32198b0e67b8cbb2f9a1c548.zip |
Remove deprecated option `use_route` in controller tests
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG.md | 4 | ||||
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 24 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/journey/formatter.rb | 15 | ||||
-rw-r--r-- | actionpack/test/controller/test_case_test.rb | 25 |
4 files changed, 5 insertions, 63 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index 838380ff71..6fc473468b 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -1,3 +1,7 @@ +* 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/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/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 |