aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/middleware
diff options
context:
space:
mode:
authorSparky <sparky@Sparkys-iMac.local>2010-09-15 12:58:49 -0700
committerSparky <sparky@Sparkys-iMac.local>2010-09-15 12:58:49 -0700
commiteeb324699169ad52d7e771ded20310afce62927d (patch)
tree7d56a6af4856213335d33a1fccac14ac75710331 /railties/test/application/middleware
parentdd6efe98b62946ae4d4df0672292449226b8d6fc (diff)
downloadrails-eeb324699169ad52d7e771ded20310afce62927d.tar.gz
rails-eeb324699169ad52d7e771ded20310afce62927d.tar.bz2
rails-eeb324699169ad52d7e771ded20310afce62927d.zip
Only add Rack::Cache to the middleware stack if config.action_controller.perform_caching is set.
Diffstat (limited to 'railties/test/application/middleware')
-rw-r--r--railties/test/application/middleware/cache_test.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/railties/test/application/middleware/cache_test.rb b/railties/test/application/middleware/cache_test.rb
index 655f9bcd55..5675cebfd9 100644
--- a/railties/test/application/middleware/cache_test.rb
+++ b/railties/test/application/middleware/cache_test.rb
@@ -24,7 +24,7 @@ module ApplicationTests
end
def simple_controller
- controller :foo, <<-RUBY
+ controller :expires, <<-RUBY
class ExpiresController < ApplicationController
def expires_header
expires_in 10, :public => !params[:private]
@@ -55,6 +55,20 @@ module ApplicationTests
RUBY
end
+ def test_cache_is_disabled_in_dev_mode
+ simple_controller
+ app("development")
+
+ get "/expires/expires_header"
+ assert_nil last_response.headers['X-Rack-Cache']
+
+ body = last_response.body
+
+ get "/expires/expires_header"
+ assert_nil last_response.headers['X-Rack-Cache']
+ assert_not_equal body, last_response.body
+ end
+
def test_cache_works_with_expires
simple_controller