diff options
author | Godfrey Chan <godfreykfc@gmail.com> | 2014-11-24 10:08:48 -0800 |
---|---|---|
committer | Godfrey Chan <godfreykfc@gmail.com> | 2014-11-24 10:08:48 -0800 |
commit | 81e0f010e88bc4eca1df0af51c5c0aae1bce4b48 (patch) | |
tree | b88af089ada3ab086dc5999205e6206720708b73 /actionpack/lib/action_controller | |
parent | 48a88305876f1b73329d325d58c9eee9f10e972b (diff) | |
parent | 23b21f6182e36c05c6b2a240c0fb824ae828465e (diff) | |
download | rails-81e0f010e88bc4eca1df0af51c5c0aae1bce4b48.tar.gz rails-81e0f010e88bc4eca1df0af51c5c0aae1bce4b48.tar.bz2 rails-81e0f010e88bc4eca1df0af51c5c0aae1bce4b48.zip |
Merge pull request #17725 from chancancode/deprecate_use_route
Deprecate use route
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 30eae41f60..cd92962dc3 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -2,6 +2,7 @@ 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' @@ -710,7 +711,27 @@ module ActionController :relative_url_root => nil, :_recall => @request.path_parameters) - route_name = options.delete :use_route + 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) @request.env["SCRIPT_NAME"] = @controller.config.relative_url_root |