diff options
author | eileencodes <eileencodes@gmail.com> | 2015-12-01 14:28:01 -0500 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2015-12-06 15:32:40 -0500 |
commit | 492b134433653cbbea1b30c459d41054f0da5ad7 (patch) | |
tree | 9a68120674fba48c25bee94d137b586da635841b /actionpack/lib/action_dispatch | |
parent | a246a69e92a8ed54eb569a662dbaba16d743b2b7 (diff) | |
download | rails-492b134433653cbbea1b30c459d41054f0da5ad7.tar.gz rails-492b134433653cbbea1b30c459d41054f0da5ad7.tar.bz2 rails-492b134433653cbbea1b30c459d41054f0da5ad7.zip |
Push `before_sending` to super class
We want to get rid of the `Live::Response` so we are consolidating methods
from `Live::Response` and `Response` by merging them together.
This adds an `#empty` method to the request so we don't need to
hard-code the empty array each time we call an empty
`ActionDispatch::Request`.
The work here is a continuation on combining controller and integration
test code bases into one.
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/http/request.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/http/response.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/testing/integration.rb | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index 3280799647..482917d71b 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -49,6 +49,10 @@ module ActionDispatch METHOD end + def self.empty + new({}) + end + def initialize(env) super @method = nil diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index f0127aa276..a4852d7031 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -412,6 +412,8 @@ module ActionDispatch # :nodoc: end def before_sending + headers.freeze + request.cookie_jar.commit! end def build_buffer(response, body) diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb index 790f9ea5d2..711ca10419 100644 --- a/actionpack/lib/action_dispatch/testing/integration.rb +++ b/actionpack/lib/action_dispatch/testing/integration.rb @@ -375,6 +375,7 @@ module ActionDispatch @request = ActionDispatch::Request.new(session.last_request.env) response = _mock_session.last_response @response = ActionDispatch::TestResponse.from_response(response) + @response.request = @request @html_document = nil @url_options = nil |