aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/middleware_test.rb
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_test.rb
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_test.rb')
-rw-r--r--railties/test/application/middleware_test.rb35
1 files changed, 31 insertions, 4 deletions
diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb
index 0ce6d482a0..f9b594eb33 100644
--- a/railties/test/application/middleware_test.rb
+++ b/railties/test/application/middleware_test.rb
@@ -19,6 +19,33 @@ module ApplicationTests
boot!
assert_equal [
+ "ActionDispatch::Static",
+ "Rack::Lock",
+ "ActiveSupport::Cache::Strategy::LocalCache",
+ "Rack::Runtime",
+ "Rails::Rack::Logger",
+ "ActionDispatch::ShowExceptions",
+ "ActionDispatch::RemoteIp",
+ "Rack::Sendfile",
+ "ActionDispatch::Callbacks",
+ "ActiveRecord::ConnectionAdapters::ConnectionManagement",
+ "ActiveRecord::QueryCache",
+ "ActionDispatch::Cookies",
+ "ActionDispatch::Session::CookieStore",
+ "ActionDispatch::Flash",
+ "ActionDispatch::ParamsParser",
+ "Rack::MethodOverride",
+ "ActionDispatch::Head",
+ "ActionDispatch::BestStandardsSupport"
+ ], middleware
+ end
+
+ test "Rack::Cache is present when action_controller.perform_caching is set" do
+ add_to_config "config.action_controller.perform_caching = true"
+
+ boot!
+
+ assert_equal [
"Rack::Cache",
"ActionDispatch::Static",
"Rack::Lock",
@@ -82,24 +109,24 @@ module ApplicationTests
test "insert middleware after" do
add_to_config "config.middleware.insert_after ActionDispatch::Static, Rack::Config"
boot!
- assert_equal "Rack::Config", middleware.third
+ assert_equal "Rack::Config", middleware.second
end
test "RAILS_CACHE does not respond to middleware" do
add_to_config "config.cache_store = :memory_store"
boot!
- assert_equal "Rack::Runtime", middleware.fourth
+ assert_equal "Rack::Runtime", middleware.third
end
test "RAILS_CACHE does respond to middleware" do
boot!
- assert_equal "Rack::Runtime", middleware.fifth
+ assert_equal "Rack::Runtime", middleware.fourth
end
test "insert middleware before" do
add_to_config "config.middleware.insert_before ActionDispatch::Static, Rack::Config"
boot!
- assert_equal "Rack::Config", middleware.second
+ assert_equal "Rack::Config", middleware.first
end
# x_sendfile_header middleware