diff options
author | eileencodes <eileencodes@gmail.com> | 2015-10-06 16:03:58 -0400 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-10-29 14:24:25 -0700 |
commit | 42eb37ab514060c4217ad2dd845d3bf05007db0f (patch) | |
tree | aa01bd5f50af04587eb4162d132918a49529b7c2 /actionpack/lib/action_controller | |
parent | b329fbb5f2706e4b3c5d9e098881f4e90d3c9a44 (diff) | |
download | rails-42eb37ab514060c4217ad2dd845d3bf05007db0f.tar.gz rails-42eb37ab514060c4217ad2dd845d3bf05007db0f.tar.bz2 rails-42eb37ab514060c4217ad2dd845d3bf05007db0f.zip |
use `dispatch` instead of `process` to run requests though
`dispatch` sets the request and response on the controller for us
automatically, so the test harness doesn't need to know the internals of
how request / response is set.
Conflicts:
actionpack/lib/action_controller/test_case.rb
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/metal/live.rb | 9 | ||||
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 7 |
2 files changed, 8 insertions, 8 deletions
diff --git a/actionpack/lib/action_controller/metal/live.rb b/actionpack/lib/action_controller/metal/live.rb index 7db8d13e24..27b3eb4e58 100644 --- a/actionpack/lib/action_controller/metal/live.rb +++ b/actionpack/lib/action_controller/metal/live.rb @@ -36,8 +36,9 @@ module ActionController extend ActiveSupport::Concern module ClassMethods - def make_response!(request) - if request.env["HTTP_VERSION"] == "HTTP/1.0" + def make_response!(response) + request = response.request + if request.get_header("HTTP_VERSION") == "HTTP/1.0" super else Live::Response.new.tap do |res| @@ -293,8 +294,8 @@ module ActionController response.close if response end - def set_response!(request) - @_response = self.class.make_response! request + def set_response!(response) + @_response = self.class.make_response! response end end end diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 2cada1f68a..698719377c 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -509,15 +509,14 @@ module ActionController end end - @controller.request = @request - @controller.response = @response - @request.fetch_header("SCRIPT_NAME") do |k| @request.set_header k, @controller.config.relative_url_root end @controller.recycle! - @controller.process(action) + @controller.dispatch(action, @request, @response) + @request = @controller.request + @response = @controller.response @request.delete_header 'HTTP_COOKIE' |