aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/response_test.rb
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2015-12-01 14:28:01 -0500
committereileencodes <eileencodes@gmail.com>2015-12-06 15:32:40 -0500
commit492b134433653cbbea1b30c459d41054f0da5ad7 (patch)
tree9a68120674fba48c25bee94d137b586da635841b /actionpack/test/dispatch/response_test.rb
parenta246a69e92a8ed54eb569a662dbaba16d743b2b7 (diff)
downloadrails-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/test/dispatch/response_test.rb')
-rw-r--r--actionpack/test/dispatch/response_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/response_test.rb b/actionpack/test/dispatch/response_test.rb
index 981d820ccf..c37679bc5f 100644
--- a/actionpack/test/dispatch/response_test.rb
+++ b/actionpack/test/dispatch/response_test.rb
@@ -5,6 +5,7 @@ require 'rack/content_length'
class ResponseTest < ActiveSupport::TestCase
def setup
@response = ActionDispatch::Response.create
+ @response.request = ActionDispatch::Request.empty
end
def test_can_wait_until_commit
@@ -39,6 +40,7 @@ class ResponseTest < ActiveSupport::TestCase
def test_response_body_encoding
body = ["hello".encode(Encoding::UTF_8)]
response = ActionDispatch::Response.new 200, {}, body
+ response.request = ActionDispatch::Request.empty
assert_equal Encoding::UTF_8, response.body.encoding
end
@@ -261,6 +263,7 @@ class ResponseTest < ActiveSupport::TestCase
test "can be explicitly destructured into status, headers and an enumerable body" do
response = ActionDispatch::Response.new(404, { 'Content-Type' => 'text/plain' }, ['Not Found'])
+ response.request = ActionDispatch::Request.empty
status, headers, body = *response
assert_equal 404, status
@@ -356,6 +359,7 @@ class ResponseIntegrationTest < ActionDispatch::IntegrationTest
resp.cache_control[:public] = true
resp.etag = '123'
resp.body = 'Hello'
+ resp.request = ActionDispatch::Request.empty
}.to_a
}
@@ -392,6 +396,7 @@ class ResponseIntegrationTest < ActionDispatch::IntegrationTest
resp.charset = 'utf-16'
resp.content_type = Mime[:xml]
resp.body = 'Hello'
+ resp.request = ActionDispatch::Request.empty
}.to_a
}