Permalink
Browse files

Revert "remove deprecated API"

This reverts commit f53c247.
  • Loading branch information...
1 parent f53c247 commit 4d073df43d6ecd99ab04dbd0773a61559325efb8 @tenderlove tenderlove committed Jan 5, 2012
@@ -431,6 +431,7 @@ def paramify_values(hash_or_array_or_value)
def process(action, http_method = 'GET', *args)
check_required_ivars
+ http_method, args = handle_old_process_api(http_method, args)
if args.first.is_a?(String)
@request.env['RAW_POST_DATA'] = args.shift
@@ -512,6 +513,17 @@ def check_required_ivars
end
end
+ def handle_old_process_api(http_method, args)
+ # 4.0: Remove this method.
+ if http_method.is_a?(Hash)
+ ActiveSupport::Deprecation.warn("TestCase#process now expects the HTTP method as second argument: process(action, http_method, params, session, flash)")
+ args.unshift(http_method)
+ http_method = args.last.is_a?(String) ? args.last : "GET"
+ end
+
+ [http_method, args]
+ end
+
def build_request_uri(action, parameters)
unless @request.env["PATH_INFO"]
options = @controller.respond_to?(:url_options) ? @controller.__send__(:url_options).merge(parameters) : parameters
@@ -338,7 +338,7 @@ def test_response_object
end
def test_render_based_on_parameters
- process :render_based_on_parameters, 'GET', "name" => "David"
+ process :render_based_on_parameters, "name" => "David"
assert_equal "Mr. David", @response.body
end
@@ -245,6 +245,13 @@ def test_process_with_request_uri_with_params
process :test_uri, "GET", :id => 7
assert_equal "/test_test/test/test_uri/7", @response.body
end
+
+ def test_process_with_old_api
+ assert_deprecated do
+ process :test_uri, :id => 7
+ assert_equal "/test_test/test/test_uri/7", @response.body
+ end
+ end
def test_process_with_request_uri_with_params_with_explicit_uri
@request.env['PATH_INFO'] = "/explicit/uri"

5 comments on commit 4d073df

Member

drogus replied Jan 20, 2012

Why was this reverted?

Contributor

josevalim replied Jan 20, 2012

iirc because the deprecation is only on the 4.0 branch.

Member

drogus replied Jan 20, 2012

So this revert can be reverted on master, right? :P

Contributor

josevalim replied Jan 20, 2012

Bro, the deprecation is on the 4.0 branch, i.e. master, we cannot remove it. :P

Member

drogus replied Jan 20, 2012

Ok, I misunderstood you, I thought that what you're saying is that this should be commited to 4.0 branch.

Please sign in to comment.