aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/middleware/cache_test.rb
diff options
context:
space:
mode:
authorManuel Menezes de Sequeira <MMSequeira@gmail.com>2011-10-05 22:14:49 +0100
committerManuel Menezes de Sequeira <MMSequeira@gmail.com>2011-10-05 22:14:49 +0100
commit07343d2974ab77bfd21c0f35930cd394ba5b164e (patch)
treec64f8b54507d41ccb2c59cb096ee8b1f2a31e2df /railties/test/application/middleware/cache_test.rb
parent8d775d5f1d58e5c0d881383e8c6e869d1d360c8c (diff)
parentd6c7185d77158caee933e84b247e37bb6a67bf58 (diff)
downloadrails-07343d2974ab77bfd21c0f35930cd394ba5b164e.tar.gz
rails-07343d2974ab77bfd21c0f35930cd394ba5b164e.tar.bz2
rails-07343d2974ab77bfd21c0f35930cd394ba5b164e.zip
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'railties/test/application/middleware/cache_test.rb')
-rw-r--r--railties/test/application/middleware/cache_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/railties/test/application/middleware/cache_test.rb b/railties/test/application/middleware/cache_test.rb
index e656ada3c0..050a2161ae 100644
--- a/railties/test/application/middleware/cache_test.rb
+++ b/railties/test/application/middleware/cache_test.rb
@@ -31,6 +31,10 @@ module ApplicationTests
$last_modified ||= Time.now.utc
render_conditionally(:last_modified => $last_modified)
end
+
+ def keeps_if_modified_since
+ render :text => request.headers['If-Modified-Since']
+ end
private
def render_conditionally(headers)
if stale?(headers.merge(:public => !params[:private]))
@@ -47,6 +51,16 @@ module ApplicationTests
RUBY
end
+ def test_cache_keeps_if_modified_since
+ simple_controller
+ expected = "Wed, 30 May 1984 19:43:31 GMT"
+
+ get "/expires/keeps_if_modified_since", {}, "HTTP_IF_MODIFIED_SINCE" => expected
+
+ assert_equal 200, last_response.status
+ assert_equal expected, last_response.body, "cache should have kept If-Modified-Since"
+ end
+
def test_cache_is_disabled_in_dev_mode
simple_controller
app("development")