aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-10-23 17:44:02 +0530
committerPratik Naik <pratiknaik@gmail.com>2008-10-23 17:44:02 +0530
commit079b5bf7a5e95c9e9c106b1ad460cc91a00e7b53 (patch)
treeb816993d25044128b9f6e2c78868622a0181e76d /actionpack/test
parent50820a9de1dbcc1568b4404cf358a1acf9ee39aa (diff)
parent896058b485653bc8a1b5ccbc1248267880a8c911 (diff)
downloadrails-079b5bf7a5e95c9e9c106b1ad460cc91a00e7b53.tar.gz
rails-079b5bf7a5e95c9e9c106b1ad460cc91a00e7b53.tar.bz2
rails-079b5bf7a5e95c9e9c106b1ad460cc91a00e7b53.zip
Merge commit 'mainstream/master'
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/render_test.rb27
1 files changed, 22 insertions, 5 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb
index 35d9b19cc0..db2d5d885b 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -48,6 +48,16 @@ class TestController < ActionController::Base
render :template => "test/hello_world"
end
+ def render_hello_world_with_last_modified_set
+ response.last_modified = Date.new(2008, 10, 10).to_time
+ render :template => "test/hello_world"
+ end
+
+ def render_hello_world_with_etag_set
+ response.etag = "hello_world"
+ render :template => "test/hello_world"
+ end
+
def render_hello_world_with_forward_slash
render :template => "/test/hello_world"
end
@@ -1338,12 +1348,21 @@ class EtagRenderTest < Test::Unit::TestCase
assert_equal "200 OK", @response.status
assert !@response.body.empty?
end
+
+ def test_render_should_not_set_etag_when_last_modified_has_been_specified
+ get :render_hello_world_with_last_modified_set
+ assert_equal "200 OK", @response.status
+ assert_not_nil @response.last_modified
+ assert_nil @response.etag
+ assert @response.body.present?
+ end
def test_render_with_etag
get :render_hello_world_from_variable
expected_etag = etag_for('hello david')
assert_equal expected_etag, @response.headers['ETag']
-
+ @response = ActionController::TestResponse.new
+
@request.if_none_match = expected_etag
get :render_hello_world_from_variable
assert_equal "304 Not Modified", @response.status
@@ -1359,10 +1378,8 @@ class EtagRenderTest < Test::Unit::TestCase
end
def test_etag_should_not_be_changed_when_already_set
- expected_etag = etag_for("hello somewhere else")
- @response.headers["ETag"] = expected_etag
- get :render_hello_world_from_variable
- assert_equal expected_etag, @response.headers['ETag']
+ get :render_hello_world_with_etag_set
+ assert_equal etag_for("hello_world"), @response.headers['ETag']
end
def test_etag_should_govern_renders_with_layouts_too