mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Deprecate Controller.process interface
This commit is contained in:
@@ -376,6 +376,7 @@ module ActionController #:nodoc:
|
||||
|
||||
# Factory for the standard create, process loop where the controller is discarded after processing.
|
||||
def process(request, response) #:nodoc:
|
||||
ActiveSupport::Deprecation.warn("Controller.process has been deprecated. Use Controller.call instead", caller)
|
||||
new.process(request, response)
|
||||
end
|
||||
|
||||
|
||||
@@ -603,7 +603,7 @@ class FilterTest < Test::Unit::TestCase
|
||||
%w(foo bar baz).each do |action|
|
||||
request = ActionController::TestRequest.new
|
||||
request.query_parameters[:choose] = action
|
||||
response = DynamicDispatchController.process(request, ActionController::TestResponse.new)
|
||||
response = Rack::MockResponse.new(*DynamicDispatchController.call(request.env))
|
||||
assert_equal action, response.body
|
||||
end
|
||||
end
|
||||
|
||||
@@ -102,19 +102,19 @@ class HelperTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_helper_for_nested_controller
|
||||
request = ActionController::TestRequest.new
|
||||
response = ActionController::TestResponse.new
|
||||
request = ActionController::TestRequest.new
|
||||
request.action = 'render_hello_world'
|
||||
|
||||
assert_equal 'hello: Iz guuut!', Fun::GamesController.process(request, response).body
|
||||
response = Rack::MockResponse.new(*Fun::GamesController.call(request.env))
|
||||
assert_equal 'hello: Iz guuut!', response.body
|
||||
end
|
||||
|
||||
def test_helper_for_acronym_controller
|
||||
request = ActionController::TestRequest.new
|
||||
response = ActionController::TestResponse.new
|
||||
request = ActionController::TestRequest.new
|
||||
request.action = 'test'
|
||||
|
||||
assert_equal 'test: baz', Fun::PdfController.process(request, response).body
|
||||
response = Rack::MockResponse.new(*Fun::PdfController.call(request.env))
|
||||
assert_equal 'test: baz', response.body
|
||||
end
|
||||
|
||||
def test_all_helpers
|
||||
@@ -211,14 +211,16 @@ class IsolatedHelpersTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_helper_in_a
|
||||
assert_raise(ActionView::TemplateError) { A.process(@request, @response) }
|
||||
assert_raise(ActionView::TemplateError) { A.call(@request.env) }
|
||||
end
|
||||
|
||||
def test_helper_in_b
|
||||
assert_equal 'B', B.process(@request, @response).body
|
||||
response = Rack::MockResponse.new(*B.call(@request.env))
|
||||
assert_equal 'B', response.body
|
||||
end
|
||||
|
||||
def test_helper_in_c
|
||||
assert_equal 'C', C.process(@request, @response).body
|
||||
response = Rack::MockResponse.new(*C.call(@request.env))
|
||||
assert_equal 'C', response.body
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user