mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Test demonstrating #3053: If-Modified-Since gets swallowed up by rack-cache.
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user