Skip to content

Commit

Permalink
Merge pull request #3202 from abscondment/3053-missing-headers
Browse files Browse the repository at this point in the history
Use rack-cache 1.1
  • Loading branch information
josevalim committed Oct 3, 2011
2 parents c10fcd2 + b05a56f commit 1eac911
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/actionpack.gemspec
Expand Up @@ -18,7 +18,7 @@ Gem::Specification.new do |s|

s.add_dependency('activesupport', version)
s.add_dependency('activemodel', version)
s.add_dependency('rack-cache', '~> 1.0.3')
s.add_dependency('rack-cache', '~> 1.1')
s.add_dependency('builder', '~> 3.0.0')
s.add_dependency('i18n', '~> 0.6')
s.add_dependency('rack', '~> 1.3.2')
Expand Down
14 changes: 14 additions & 0 deletions railties/test/application/middleware/cache_test.rb
Expand Up @@ -31,6 +31,10 @@ def expires_last_modified
$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]))
Expand All @@ -47,6 +51,16 @@ def render_conditionally(headers)
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")
Expand Down

0 comments on commit 1eac911

Please sign in to comment.