aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-08-17 19:09:38 -0500
committerJoshua Peek <josh@joshpeek.com>2008-08-17 19:09:38 -0500
commitb8e930aa016e26471046d3f7d7ca1c10103791e7 (patch)
tree65733f05f69fa0b8648b8c473e34fdf5e8d16c2d /actionpack/test
parent894f9ccc5354c29e102f316f388d1dc0b98ef080 (diff)
downloadrails-b8e930aa016e26471046d3f7d7ca1c10103791e7.tar.gz
rails-b8e930aa016e26471046d3f7d7ca1c10103791e7.tar.bz2
rails-b8e930aa016e26471046d3f7d7ca1c10103791e7.zip
Merge RackProcess#normalize_headers logic into AbstractResponse#prepare!
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/rack_test.rb35
1 files changed, 23 insertions, 12 deletions
diff --git a/actionpack/test/controller/rack_test.rb b/actionpack/test/controller/rack_test.rb
index d1650de1fc..30a1144aad 100644
--- a/actionpack/test/controller/rack_test.rb
+++ b/actionpack/test/controller/rack_test.rb
@@ -236,10 +236,17 @@ class RackResponseTest < BaseRackTest
def test_simple_output
@response.body = "Hello, World!"
+ @response.prepare!
status, headers, body = @response.out(@output)
assert_equal "200 OK", status
- assert_equal({"Content-Type" => "text/html", "Cache-Control" => "no-cache", "Set-Cookie" => []}, headers)
+ assert_equal({
+ "Content-Type" => "text/html",
+ "Cache-Control" => "private, max-age=0, must-revalidate",
+ "ETag" => '"65a8e27d8879283831b664bd8b7f0ad4"',
+ "Set-Cookie" => [],
+ "Content-Length" => "13"
+ }, headers)
parts = []
body.each { |part| parts << part }
@@ -250,6 +257,7 @@ class RackResponseTest < BaseRackTest
@response.body = Proc.new do |response, output|
5.times { |n| output.write(n) }
end
+ @response.prepare!
status, headers, body = @response.out(@output)
assert_equal "200 OK", status
@@ -265,13 +273,16 @@ class RackResponseTest < BaseRackTest
@request.cgi.send :instance_variable_set, '@output_cookies', [cookie]
@response.body = "Hello, World!"
+ @response.prepare!
status, headers, body = @response.out(@output)
assert_equal "200 OK", status
assert_equal({
"Content-Type" => "text/html",
- "Cache-Control" => "no-cache",
- "Set-Cookie" => ["name=Josh; path="]
+ "Cache-Control" => "private, max-age=0, must-revalidate",
+ "ETag" => '"65a8e27d8879283831b664bd8b7f0ad4"',
+ "Set-Cookie" => ["name=Josh; path="],
+ "Content-Length" => "13"
}, headers)
parts = []
@@ -285,18 +296,18 @@ class RackResponseHeadersTest < BaseRackTest
super
@response = ActionController::RackResponse.new(@request)
@output = StringIO.new('')
- @response.headers['Status'] = 200
+ @response.headers['Status'] = "200 OK"
end
def test_content_type
[204, 304].each do |c|
- @response.headers['Status'] = c
- assert !response_headers.has_key?("Content-Type")
+ @response.headers['Status'] = c.to_s
+ assert !response_headers.has_key?("Content-Type"), "#{c} should not have Content-Type header"
end
[200, 302, 404, 500].each do |c|
- @response.headers['Status'] = c
- assert response_headers.has_key?("Content-Type")
+ @response.headers['Status'] = c.to_s
+ assert response_headers.has_key?("Content-Type"), "#{c} did not have Content-Type header"
end
end
@@ -305,8 +316,8 @@ class RackResponseHeadersTest < BaseRackTest
end
private
-
- def response_headers
- @response.out(@output)[1]
- end
+ def response_headers
+ @response.prepare!
+ @response.out(@output)[1]
+ end
end