aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/rack_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/dispatch/rack_test.rb')
-rw-r--r--actionpack/test/dispatch/rack_test.rb24
1 files changed, 19 insertions, 5 deletions
diff --git a/actionpack/test/dispatch/rack_test.rb b/actionpack/test/dispatch/rack_test.rb
index 92e6f163b2..9fad4b22ee 100644
--- a/actionpack/test/dispatch/rack_test.rb
+++ b/actionpack/test/dispatch/rack_test.rb
@@ -218,7 +218,7 @@ class RackResponseTest < BaseRackTest
"Content-Type" => "text/html; charset=utf-8",
"Cache-Control" => "private, max-age=0, must-revalidate",
"ETag" => '"65a8e27d8879283831b664bd8b7f0ad4"',
- "Set-Cookie" => [],
+ "Set-Cookie" => "",
"Content-Length" => "13"
}, headers)
@@ -227,7 +227,22 @@ class RackResponseTest < BaseRackTest
assert_equal ["Hello, World!"], parts
end
- test "streaming block" do
+ def test_utf8_output
+ @response.body = [1090, 1077, 1089, 1090].pack("U*")
+ @response.prepare!
+
+ status, headers, body = @response.to_a
+ assert_equal 200, status
+ assert_equal({
+ "Content-Type" => "text/html; charset=utf-8",
+ "Cache-Control" => "private, max-age=0, must-revalidate",
+ "ETag" => '"ebb5e89e8a94e9dd22abf5d915d112b2"',
+ "Set-Cookie" => "",
+ "Content-Length" => "8"
+ }, headers)
+ end
+
+ def test_streaming_block
@response.body = Proc.new do |response, output|
5.times { |n| output.write(n) }
end
@@ -237,13 +252,12 @@ class RackResponseTest < BaseRackTest
assert_equal 200, status
assert_equal({
"Content-Type" => "text/html; charset=utf-8",
- "Content-Length" => "",
"Cache-Control" => "no-cache",
- "Set-Cookie" => []
+ "Set-Cookie" => ""
}, headers)
parts = []
- body.each { |part| parts << part }
+ body.each { |part| parts << part.to_s }
assert_equal ["0", "1", "2", "3", "4"], parts
end
end